| От | Grzegorz Jaśkiewicz |
|---|---|
| Тема | Re: Understanding INNER JOIN versus IN subquery |
| Дата | |
| Msg-id | 2f4958ff0907200728u14f43f0bre14411237c6af355@mail.gmail.com обсуждение исходный текст |
| Ответ на | Understanding INNER JOIN versus IN subquery (Robert James <srobertjames@gmail.com>) |
| Список | pgsql-general |
On Mon, Jul 20, 2009 at 2:37 PM, Robert James<srobertjames@gmail.com> wrote:
> I have two queries which should be equivalent. The Planner plans them
> differently, although they are both about the same time. Can someone
> explain why?
> select word from dict
> where
> word in
> (select substr('moon', 0, generate_series(3,length('moon'))))
>
> select * from dict
> inner join (select substr('moon', 0, generate_series(3,length('moon')))) as
> m
> on dict.word = m.substr
>
> Is one preferred?
it is hard to say from your example. But in my general expierence, I
noticed similar thing many times.
Needless to say, I prefer personally to choose JOINs instead of IN(),
because those tend to be faster on postgresql.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера