Re: slow IN() clause for many cases

Поиск
Список
Период
Сортировка
Искать
От
Greg Stark
Тема
Re: slow IN() clause for many cases
Дата
Msg-id
87mzlafolq.fsf@stark.xeocode.com
Ответ на
Список
Дерево обсуждения
Re: slow IN() clause for many cases Andrew - Supernews <andrew+nonews@supernews.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>
Re: slow IN() clause for many cases Simon Riggs <simon@2ndquadrant.com>
Re: slow IN() clause for many cases Simon Riggs <simon@2ndquadrant.com>
Re: slow IN() clause for many cases Tom Lane <tgl@sss.pgh.pa.us>
Re: slow IN() clause for many cases Simon Riggs <simon@2ndquadrant.com>
Re: slow IN() clause for many cases Martijn van Oosterhout <kleptog@svana.org>
Re: slow IN() clause for many cases Simon Riggs <simon@2ndquadrant.com>
Re: slow IN() clause for many cases Martijn van Oosterhout <kleptog@svana.org>
Re: slow IN() clause for many cases Tom Lane <tgl@sss.pgh.pa.us>
Re: slow IN() clause for many cases Greg Stark <gsstark@mit.edu>
Re: slow IN() clause for many cases Joe Conway <mail@joeconway.com>
Re: slow IN() clause for many cases David Fetter <david@fetter.org>
Re: slow IN() clause for many cases mark@mark.mielke.cc
Re: slow IN() clause for many cases Tom Lane <tgl@sss.pgh.pa.us>
Re: slow IN() clause for many cases Greg Stark <gsstark@mit.edu>
Re: slow IN() clause for many cases Tom Lane <tgl@sss.pgh.pa.us>
Re: slow IN() clause for many cases Greg Stark <gsstark@mit.edu>
Re: slow IN() clause for many cases Tom Lane <tgl@sss.pgh.pa.us>
Re: slow IN() clause for many cases Greg Stark <gsstark@mit.edu>
Re: slow IN() clause for many cases Martijn van Oosterhout <kleptog@svana.org>
Re: slow IN() clause for many cases Tom Lane <tgl@sss.pgh.pa.us>
Re: slow IN() clause for many cases Greg Stark <gsstark@mit.edu>
Re: slow IN() clause for many cases Martijn van Oosterhout <kleptog@svana.org>
Re: slow IN() clause for many cases Greg Stark <gsstark@mit.edu>
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>
Tom Lane  writes:

> It strikes me that now that we have the bitmap indexscan mechanism,
> it wouldn't be hard to do better.  I'm thinking that IN should be
> converted to a ScalarArrayOpExpr, ie
> 
> 	x = ANY (ARRAY[val1,val2,val3,val4,...])
> 
> and then we could treat both OpExpr and ScalarArrayOpExpr as matching
> an index when the LHS is the index key and the operator is in the
> index's opclass.  This wouldn't fit comfortably into a plain indexscan,
> but a bitmap indexscan has already got the mechanism for ORing together
> the results of several primitive indexscans (one per array element).
> You just do the scans and insert all the results into your output
> bitmap.

Would this mean it would be impossible to get a fast-start plan for an IN
expression though?

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.

(Actually I'm more interested in cases where instead of LIMIT 1 it's the
client that will stop as soon as it finds the record it's really looking for.)


-- 
greg


В списке pgsql-hackers по дате отправления
От: Darko Prenosil
Дата:
Сообщение: Re: drop if exists
От: Tom Lane
Дата:
FAQ