The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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.)
|
#3
|
|||
|
|||
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 ****** // This option allows you to turn persistent connections to MySQL on or off. // The difference in performance is negligible for all but the largest boards. // If you are unsure what this should be, leave it off. (0 = off; 1 = on) $config['MasterServer']['usepconnect'] = 0; Regards, Razvan |
#4
|
||||
|
||||
Quote:
Quote:
|
#5
|
|||
|
|||
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) SELECT user_id, event_day, event_time, event_type, multiplication_factor, vp, red_points, blue_points, green_points, yellow_points, black_points FROM event_history; Regards, Razvan |
#6
|
||||
|
||||
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. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|