Re: IN vs =
От | Tom Lane |
---|---|
Тема | Re: IN vs = |
Дата | |
Msg-id | 29955.1233005605@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | IN vs = ("Lukas" <lukas@fmf.vtu.lt>) |
Ответы |
Re: IN vs =
|
Список | pgsql-novice |
"Lukas" <lukas@fmf.vtu.lt> writes: > I would like to ask, what is the main difference between operators IN and > '='. > Then I use operator IN in JOIN it gives me much worse time (in my example > ~3000ms) at the same time '=' gives 30ms! > But the most interesting think is that at the begging (when DB was > smaller) worked at the same speed as '=', why? Was it also on a different PG release back then? > LEFT JOIN b_mokejimu_sudengimai ON (mok_id IN (ms_mokejimas, ms_padengimas)) > Join Filter: (b_mokejimai.mok_id = ANY > (ARRAY[b_mokejimu_sudengimai.ms_mokejimas, > b_mokejimu_sudengimai.ms_padengimas])) The latest 8.2.x and 8.3.x releases contain a patch that avoids using this construct when there are variables on the right-hand side; I think that's your problem. (FWIW, most people would probably say that having to write a join like this suggests you need to refactor your database structure...) regards, tom lane
В списке pgsql-novice по дате отправления: