Re: huge disparities in =/IN/BETWEEN performance

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: huge disparities in =/IN/BETWEEN performance
Дата
Msg-id 20070209021414.GU24069@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: huge disparities in =/IN/BETWEEN performance  ("George Pavlov" <gpavlov@mynewplace.com>)
Ответы Re: huge disparities in =/IN/BETWEEN performance  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
George Pavlov wrote:

> the basic question i have is fairly clear though: why saying "where x =
> 10" should be  different (in ANY cicumstance, not just mine) from saying
> "where x between 10 and 10" or from "where x in (select ... /* some
> query that returns 10 */)" ??? 

I think the principle here is that the system is not gonna waste cycles
on dumb queries.  Supposedly, morphing "foo BETWEEN 10 and 10" into
"foo=10" is not a trivial transformation, and it'd impose a planning
cost on all non-dumb BETWEEN queries.  That cost is best avoided: if you
optimize for dumb users, the smart users then want you buried because
you've lost performance doing useless work.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


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

Предыдущее
От: "George Pavlov"
Дата:
Сообщение: Re: huge disparities in =/IN/BETWEEN performance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: huge disparities in =/IN/BETWEEN performance