Andy... What you say at the very end "Do you save by not making as many connections?" made me think that you are creating and dropping a connection *FOR EACH INSERT/UPDATE*. This is not necessary and will contribute greatly to the amount of time it takes for you to process your records.
All you need to do is open 1 connection at the beginning of your script/process and close it when you are done. If I need multiple communication paths in the same process (like pumping data from one server to another) then I will open up more than one connection. I have found that when doing web-related data manipulation I get the best performance and availability from my database servers if I prepare whatever statements I can, open a connection as late as possible, do my database business, and drop the connection as soon as possible. Only under strange circumstances have I had the open and close connection statements INSIDE a loop. Respectfully, Shawn Green Database Administrator Unimin Corporation - Spruce Pine [EMAIL PROTECTED] om To: <[EMAIL PROTECTED]> cc: 06/14/2004 02:58 Fax to: PM Subject: RE: Sending multiple queries to MySQL (sorry, hit send by accident!) Yes, you can save using multiple statements. We send hundreds...thousands of statements in a single batch in our machine automation application. The communication cost is relatively fixed (with in reason), where the actual work to be done (mostly inserts) was very fast for us in our table schemas. Ed -----Original Message----- From: Andy Hall [mailto:[EMAIL PROTECTED] Subject: Sending multiple queries to MySQL (sorry, hit send by accident!) Hi, I have a situation where, within a PHP loop, I am creating over one hundred SQL statement (INSERTS and UPDATES). Would it cut any overhead to send 20 ";" seperated queries in one mysql_query() statement, and therefore only execute mysql_query() 5 times for 100 statements, as opposed to sending each statement individually? So, mysql_query("INSERT 1", "UPDATE 1...", "INSERT 2...", "UPDATE 2.."); or: mysql_query("INSERT 1"); mysql_query("UPDATE 1..."); mysql_query("INSERT 2..."); mysql_query("UPDATE 2.."); Do you save by not making as many connections? Thanks Andy. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]