Jump to content

Optimize query


jaymc

Recommended Posts

I have a cron job execute a script every 1 minute

 

That script queries a table and drags out 15,000 rows, and for each row then executes another query on updating a table

 

So thats basically 15,000 queries..

 

Its killing the server when it runs and locking mysql quite heavily

 

Rather than have 15,000 seperate queries I was think of using 1 query and structuring it as so

 

WHERE IN ID (1,2,3,4,5,6,7.......15,000)

 

A whopping single query, but could it cope with 15,000 'IN IDs' and would it be better than just having 15,000 single queries

Link to comment
https://forums.phpfreaks.com/topic/40713-optimize-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.