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
First create INDEX
on 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.