> > regarding mysql_pconnect() we haven't tried that, but the nature of
> > the site suggests it would need like 500 apache deamons connected
> > all the time. And that's a lot of sort buffers and stuff beeing
> > allocated for each one of those ?

Not if you disable keepalive requests, which I do on most web servers with
heavy PHP and MySQL usage. It doesn't impact performance on the client side
much since we keep our images on another server which can have keepalives
enabled.

You said you had messageboards, guestbooks, etc. Do any of these scripts use
something like...

SELECT table1.stuff, table2.stuff, table3.stuff FROM table1, table2, table3
WHERE (required constraints for joins) AND table1.messageboardid = '#' ORDER
BY table1.timestamp DESC LIMIT 5;

? On large tables, this will lock the table for a long time since MySQL
can't follow indices in reverse order, so it ends up having to do a full
table scan. I have found that breaking it into two separate queries has
improved performance considerably:

SELECT id FROM table1 WHERE messageboardid = '#' ORDER BY timestamp DESC
LIMIT 5;
SELECT table1.stuff, table2.stuff, table3.stuff FROM table1, table2, table3
WHERE (required constraints for joins) AND table1.id IN (ids taken from
previous query, separated by commas);

This reduces the amount of time MySQL will lock the table, since with the
first query it will do the full table scan on all 3 tables involved in the
join and will keep all 3 tables locked for that time. I have seen times
where the first method with one query takes 10 to 15 seconds to execute,
while the second method with two separate queries both take 0.00 sec
according to the MySQL command line client.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to