Re: Odd behavior with indices

Поиск
Список
Период
Сортировка
От Matheus de Oliveira
Тема Re: Odd behavior with indices
Дата
Msg-id CAJghg4LjNjMX1Ppden+vhT-_=pPT2_gJZugc0F=8yzk1BUTtBw@mail.gmail.com
обсуждение исходный текст
Ответ на Odd behavior with indices  (joe meiring <josephmeiring@gmail.com>)
Ответы Re: Odd behavior with indices  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance


Em 26 de fev de 2016 4:44 PM, "joe meiring" <josephmeiring@gmail.com> escreveu:
>
> The same query for parameters is rather slow and does NOT use the index:
>
> EXPLAIN ANALYZE
> select *
> from parameter
> where exists (
>       select 1 from datavalue
>       where datavalue.parameter_id = parameter.id limit 1
> );
>

Please, could you execute both queries without the LIMIT 1 and show us the plans?

LIMIT in the inner query is like a fence and it caps some optimizations available for EXISTS, you'd better avoid it and see if you get a proper semi-join plan then.

Regards.

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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Merge joins on index scans
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Odd behavior with indices