On 9-mei-2007, at 11:28, bash wrote:
SELECT type, stamp_id, old_player_id, new_player_id
FROM town_log
WHERE old_player_id = $ID OR new_player_id = $ID
ORDER BY stamp_id DESC;
This query works really slowly and i don't know why :/
For example, the same result by another QUERY work much faster!
SELECT type, stamp_id, old_player_id, new_player_id
FROM town_log
WHERE old_player_id = $ID
UNION
SELECT type, stamp_id, old_player_id, new_player_id
FROM town_log
WHERE new_player_id = %d
ORDER BY stamp_id DESC;
Hello Humanoid,
UNION performing much better than an equivalent query with OR is a
known 'limitation' in many database systems, including MySQL and
SQLite. Page 52 of http://www.sqlite.org/php2004/slides-all.html
explicitly recommends to use UNION here.
Cheers, Peter.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------