Henning Schroeder wrote:
> idea? And how am I supposed to find the slow queries?
Use EXPLAIN SELECT ...
http://www.mysql.com/doc/E/X/EXPLAIN.html
Also, if you run 'mysqladmin processlist' if you see a 'copying into temp table' that
lasts a
while (e.g run mysqladmin multiple times and see if it is the same query that is
copying) then
that is the query that is selecting lots of stuff and hanging the database.
You can see if you are really using the indexes you think and if they are being used
in the
'right' order. Don't forget to do [my]isamcheck -a table.MYI to get better use of
indexes.
If you are joining on the userid and since it will be the first key for the user table
(primary keys are always first), sort the index based on that: myisamchk -R 1
table.MYI. And
don't forget myisamchk -r table.MYI. You have to run that
/with/the/path/to/the/table.MYI.
http://www.mysql.com/doc/O/p/Optimization.html
> I`m not quite sure whether it is really a contention problem. A standard
It looks like you are only using ISAM tables which do not support row-level locking.
You
might want to try InnoDB as the table type as that does support row-level locks. The
other
thing is that is you have a select that 'copies to temp table' it will lock the other
queries
until it completes that.
> i just tried the above query ten times. result: 7x 0.00sec, 1x0.01, 1x0.02,
> 1x0.04. does that spell "slow"?
Naw. That should be fine.
> Type II:
>
> update users set lastlogin=999697993, perstopre="f" where uid=40651;
>
> update users set lastlogin=999698763, votescast="1514", prevvote="-8" where
> uid=54307;
>
> (the usual locked queries)
>
How long do these take? What does 'mysqladmin processlist' say for these when you
execute
them (if they take a long time)?
--Bill
---------------------------------------------------------------------
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