Related Topics


[Video CMS v4]method for decreasing waiting queries  (Read 2331 times) Print

1 B


dtiberio  May 19, 2014, 11:30:33 AM

when you run a query on the database, sometimes it has to wait because the table is locked or otherwise busy. I see this a lot, and then the site stope working.

use this command to fix it:
mysql> show open tables where In_use > 0;
+----------+-------------+--------+-------------+
| Database | Table       | In_use | Name_locked |
+----------+-------------+--------+-------------+
| phpvibe  | vibe_videos |      4 |           0 |
+----------+-------------+--------+-------------+
1 row in set (0.00 sec)

mysql>

if In_use is greater than 0, then the cron should be halted until In_use is equal to 0. then you won't have problems with the database being tied up or the site being locked out when crons are running. in the example above, the vibe_videos table is busy, and all the other tables in the database are not, so any query against the vibe_videos table will have to wait until its free, and lock out potential requests by the web visitors

also, use INSERT DELAYED on cron updates because they are less important than visitors accessing the site.

Logged