duanhemou9834 2017-03-06 12:10
浏览 406

MYSQL占用插入记录的时间太长

MYSQL take too much time for insertion record
I have 32 GB RAM Dedicated Server and its hardly use CPU upto 15% and Memory 20% even 5 crons simultaneously executing. The issue is that, there is PHP script has simple 200 lines of code with some basic calculation and total 3 queries to select and insert with 12 column (4 has an integer, 8 has varchar datatype)

It executes once per day and insert records around 280000 to 300000 records, it takes on average 5-6 hours to execute.

Questions:

1) Why it takes 5-6 hours to insert just 3 lack of records?

2) Why it's not used much resources, RAM and CPU?

3) Is that any configuration to limit mysql execution?

Server Details: Total 4 processors each have Intel(R) Xeon(R) CPU E3-1220 v3 @ 3.10GHz Cache 8192 KB 32 GB RAM

Please help me to figure out the issue

  • 写回答

1条回答 默认 最新

  • dsqve08622 2017-03-06 12:13
    关注

    First create INDEXon YOUR table .Then try to Execute this query

    SELECT COLUMN1,COLUMN2..
    FROM YOUR.
    

    How much time it took for execution?Note down that timing and Note down Execution timing for same query without creating index on both table. You will definitely get more timing. So indirectly it indicates that Data you want to insert is more dependent on how fast it was fetched. So once Fetching is fast obviously insertion is faster than previous one.

    Hope this will helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看