dousao2186 2014-10-02 08:05
浏览 272
已采纳

哪一个是最好的CSV或JSON才能导入大数据(PHP)[关闭]

I'm trying to get a big number of data (about 3M rows) and I have only two options to do that.

  1. Call an API then recover the 3M JSON objects.
  2. Import a CSV file containing the 3M rows.

I didn't test any of these solutions yet to tell which one is best in terms of speed.

  • 写回答

1条回答 默认 最新

  • doulei3488 2014-10-02 13:17
    关注

    If you want to retrieve simple data as lists or rows with some columns the option #2 is the good one, you can read below a set of advantages and disadvantages:

    Pros

    • Less bandwidth needed because json needs more syntax characters to keep the format while csv is as simple as use a character separator
    • Process data is faster because only needs to split by the separator character while JSON needs to interpret the syntax
    • Big data technology as Hadoop have an integrated parse for CSV format while needs an specific function for parse Json (for example using Hive language).

    Cons

    • Unstructured data and more difficult to be read by humans
    • You have to take care with separator character cannot appear in data fields.

    If the data will contains complex data as tupla, arrays and structures JSON is better because:

    • Keeps a clear and structured format
    • Doesn't repeat data to reference it because one label could contain multiple data.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch