Speed difference between != and = operators?

Поиск
Список
Период
Сортировка
От Paul Caskey
Тема Speed difference between != and = operators?
Дата
Msg-id 3985D639.6523CCCD@nmxs.com
обсуждение исходный текст
Ответы Re: Speed difference between != and = operators?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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@nmxs.com        Software Engineer
New Mexico Software    5041 Indian School NE    Albuquerque, NM 87110
--

В списке pgsql-general по дате отправления:

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: Re: How I can undelete recodes?
Следующее
От: "Bryan White"
Дата:
Сообщение: Re: Corrupted Table