what is the maximum number of queries
What is the maximum number of queries that can be run in a dedicated server with 4 GB of RAM in one instance.
I am running a cron job that may contains queries near to one hundred thousand.its queries running in a loop,开发者_JAVA百科 queries are simple queries selecting 3 fields with integer fields.
please advice
42, of course. The 43rd query breaks it. No, really :-)
There is no upper limit on the number of queries -- the loop can run all day. Unless there is some form of parallel code (i.e. threads), each query from the cron-job will run in series (sends query, processes result, sends query, processes...) and thus the number of total queries is irrelevant in terms of memory requirements.
There is, however, a potential (if absolutely absurd) limit with updates/inserts/deletes that run within a single transaction. This is because the transaction needs to be able to be rolled-back. (I am not sure if this is bound by storage, main memory, or otherwise.)
Happy coding.
Since this is a long-running job, take note: If the cron-job "runs into" the next cron-job (does not complete in time), then serious issues can result as the same "job" may be executing multiple times! This ugly situation can quickly spiral out of control if the cron-jobs keep cascading into each other: each concurrently running "job" will place more burden on the database server.
精彩评论