Re: Optimize query: time of "single * IN(many)" > time of "many * IN(single)"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Optimize query: time of "single * IN(many)" > time of "many * IN(single)"
Дата
Msg-id 6191.1073574080@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Optimize query: time of "single * IN(many)" > time of "many * IN(single)"  ("Paul Janssen" <postgresuser@hotmail.com>)
Список pgsql-general
"Paul Janssen" <postgresuser@hotmail.com> writes:
> Can anyone help me out with the following situation:
>    (a) a single query with 550 id's in the IN-clause resulting into 800+
> seconds;
>    (b) 550 queries with a single id in the IN-clause resulting into overall
> time of <60 seconds;
> The table consists of 950.000 records, and the resultset consists of 205.000
> records.

> Why is there such an extreme difference in time?

Most likely the planner is opting not to use an indexscan in the first
case.  Could we see EXPLAIN ANALYZE results for both cases?  Also, try
"SET enable_seqscan TO OFF" and then repeat EXPLAIN ANALYZE for case (a).

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Compile problem on old Debian Linux with glibc 2.0.7
Следующее
От: Tom Lane
Дата:
Сообщение: Re: order by is ambiguous