dounai6626 2011-01-07 14:26
浏览 28
已采纳

下载大数据集 - >文本到MySQL或只是MySQL?

I'm downloading large sets of data via an XML Query through PHP with the following scenario: - Query for records 1-1000, download all parts (1000 parts has roughly 4.5 megs of text), then store those in memory while i query the next 1001 - 2000, store in mem (up to potentially 400k)

I'm wondering if it would be better to write these entries to a text field, rather than storing them in memory and once the complete download is done trying to insert them all up into the DB or to try and write them to the DB as they come in.

Any suggestions would be greatly appreciated.

Cheers

  • 写回答

3条回答 默认 最新

  • dongqiang2024 2011-01-07 14:37
    关注

    You can run a query like this:

    INSERT INTO table (id, text)
    VALUES (null, 'foo'), (null, 'bar'), ..., (null, 'value no 1000');
    

    Doing this you'll do the thing in one shoot, and the parser will be called once. The best you can do, is running something like this with the MySQL's Benchmark function, running 1000 times a query that inserts 1000 records, or 1000000 of inserts of one record.

    (Sorry about the prev. answer, I've misunderstood the question).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度