Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions
От
David G. Johnston
Тема
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions
Дата
Msg-id
CAKFQuwZ5Ep+ojefGJPNKowh0jfjOM1jEVALR=Grw+HB9iNjQNQ@mail.gmail.com
Ответ на
Список
Дерево обсуждения
[GENERAL] Perfomance of IN-clause with many elements and possible solutions "dilaz03 ." <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements andpossible solutions PT <wmoran@potentialtech.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements andpossible solutions PT <wmoran@potentialtech.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Tom Lane <tgl@sss.pgh.pa.us>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Tom Lane <tgl@sss.pgh.pa.us>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions Dmitry Lazurkin <dilaz03@gmail.com>
Re: [GENERAL] Perfomance of IN-clause with many elements and possible solutions Jeff Janes <jeff.janes@gmail.com>
- IN-VALUES clause adds new node to plan. Has additional node big overhead? How about filter by two or more IN-VALUES clause?
IN-VALUES is just another word for "TABLE" which is another word for "RELATION". Writing relational database queries that use explicit relations is generally going to give you the best performance.
Basically you want to write something like:
SELECT *
FROM ids
JOIN ( :values_clause ) vc (vid) ON (vc.vid = ids.id)
or
WITH vc AS (SELECT vid FROM .... ORDER BY ... LIMIT )
SELECT *
FROM ids
JOIN vc ON (vid = ids.id)
"IN ('l1','l2','l3')" is nice and all but as demonstrated the mechanics of executing that are different, and slower, than processing relations and tuples. For a small number of items the difference is generally not meaningful and so the convenience of writing (IN (...)) is worth taking.
David J.
В списке pgsql-general по дате отправления
От: PT
Дата:
От: Dmitry Lazurkin
Дата: