Hello All,
Im using SQLite-3.3.17.
My table is:
CREATE TABLE town_log (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
town_id int,
stamp_id int,
old_player_id int,
new_player_id int,
type int
);
CREATE INDEX tl_np_id on town_log(new_player_id);
CREATE INDEX tl_op_id on town_log(old_player_id);
CREATE INDEX tl_st_id on town_log(stamp_id);
CREATE INDEX tl_tw_id on town_log(town_id);
CREATE INDEX tl_type on town_log(type);
And I'm trying to execute this query:
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;
Timing by
http://katastrophos.net/andre/blog/2007/01/04/sqlite-simple-timing-profiler-patch/
shows this times:
1st query: 0.250 s.
2st query: 0.000 s.
PS. ANALYZE do not help to solve this problem. I think problem(?) in
query optimizer.
--
Biomechanical Artificial Sabotage Humanoid
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------