This query takes 206 seconds:
SELECT t1.blah, t1.foo, t2.id
FROM t1, t2, t3
WHERE t1.SessionId = 427
AND t1.CatalogId = 22
AND t1.CatalogId = t3.CatalogId
AND t2.id = t3.SomeId
AND t2.Active != 0
If I change the last line to this, it takes 1 second:
AND t2.Active = 1
The "Active" field is 0 or 1. The query returns the same rows, either way
(about 1700 rows). There is an index on the Active field.
These two queries both take 1 second:
SELECT * FROM t2 WHERE Active = 1;
SELECT * FROM t2 WHERE Active != 0;
Any ideas? Possible bug?
--
Paul Caskey paul(at)nmxs(dot)com Software Engineer
New Mexico Software 5041 Indian School NE Albuquerque, NM 87110
--