![]() |
How do I know if db->query_write is reusing a SQL connection ?
Hi,
I read somewhere that opening a connection for each transaction is an operation should be avoided because it can be intensive. I need to insert a big number of rows in a table so I need to find out if “db->query_write” is reusing the connection or not. (this is the first optimization that comes to my mind) Regards, Razvan |
vBulletin only opens one connection per page and uses that until the end of execution. (Different if you turned on persistent connections in config.php.)
|
Quote:
How can I be sure about this ? Is there a tool on mysql side to check how many connection were created ? (like a log file for connections) One more thing: what about persistent connections ? I assume that you are talking about this: Code:
// ****** MASTER DATABASE PERSISTENT CONNECTIONS ****** Regards, Razvan |
Quote:
Quote:
|
I did the following experiment:
Code:
INSERT INTO event_shadow (user_id, event_day, event_time, event_type, multiplication_factor, vp, red_points, blue_points, green_points, yellow_points, black_points) Regards, Razvan |
Well, IMHO,
Every time you perform an insert operation, mysql has to adjust the index to cope with the new value. the table copy operation performs the insert as a single transaction, and then does a single re-index at the end. You can achieve the same result by doing a multiple insert. insert into table (f1,f2,f3) values (v1,v2,v3),(x1,x2,x3),(y1,y2,y3) You can also use alter table tablename disable keys before the bulk insert, and alter table tablename enable keys once it is done. Speed improvements will depend on what fields you have indexed. |
All times are GMT. The time now is 10:03 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|