Re: PostgreSQL OR performance

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: PostgreSQL OR performance
Дата
Msg-id 1225902700.1432.53.camel@jdavis
обсуждение исходный текст
Ответ на PostgreSQL OR performance  ("Віталій Тимчишин" <tivv00@gmail.com>)
Ответы Re: PostgreSQL OR performance  ("Віталій Тимчишин" <tivv00@gmail.com>)
Список pgsql-performance
On Wed, 2008-11-05 at 13:12 +0200, Віталій Тимчишин wrote:
> For a long time already I can see very poor OR performance in
> postgres.
> If one have query like "select something from table where condition1
> or condition2" it may take ages to execute while
> "select something from table where condition1" and "select something
> from table where condition2" are executed very fast and
> "select something from table where condition1 and not condition2 union
> all select something from table where condition2" gives required
> results fast
>

What version are you using?

Have you run "VACUUM ANALYZE"?

Next, do:

EXPLAIN ANALYZE select something from table where condition1 or
condition2;

for each of the queries, unless that query takes so long you don't want
to wait for the result. In that case, omit the "ANALYZE" and just do
"EXPLAIN ...".

Then post those results to the list. These tell us what plans PostgreSQL
is choosing and what it estimates the costs to be. If it's the output of
EXPLAIN ANALYZE, it also runs the query and tells us what the costs
really are.

From that, we can see where the planner is going wrong, and what you
might do to change it.

Regards,
    Jeff Davis


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL OR performance
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Create and drop temp table in 8.3.4