Re: slow IN() clause for many cases

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: slow IN() clause for many cases
Дата
Msg-id 8764ryfmav.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: slow IN() clause for many cases  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: slow IN() clause for many cases  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Greg Stark <gsstark@mit.edu> writes:
> > I would fear queries like
> 
> >  SELECT * from tab WHERE x IN (1,2,3) LIMIT 1
> 
> > Which ought to be instantaneous would become potentially slow.
> 
> Why?  They certainly wouldn't be any slower than they are now.

Well currently they get rewritten to use OR which does a single index scan
which I assumed returned rows as soon as it finds them like it does for
regular range lookup index scans. Is that assumption wrong?

The bitmap scan has to traverse all the index entries for matching records
before it can fetch the first record. So it wouldn't be a fast-start plan. Not
as bad as performing a sort step or anything like that of course.

-- 
greg



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: A costing analysis tool
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: A costing analysis tool