Re: Query optimization problem

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Query optimization problem
Дата
Msg-id AANLkTi=S6GjWxeSnoHOeL4ciBA2LcbR6eEZAyEUMFGLM@mail.gmail.com
обсуждение исходный текст
Ответ на Query optimization problem  (Zotov <zotov@oe-it.ru>)
Ответы Re: Query optimization problem  (Dimitri Fontaine <dfontaine@hi-media.com>)
Список pgsql-hackers
On Tue, Jul 20, 2010 at 1:57 AM, Zotov <zotov@oe-it.ru> wrote:
> i wrote to
>   pgsql-bugs@postgresql.org
> they tell me write to
>   pgsql-performance@postgresql.org
> they tell me write here
>
> I don`t whant know how optimize query myself (i know it), and i think it
> must do planner.

According to the EXPLAIN ANALYZE output, your "slow" query is
executing in 0.007 ms, and your "fast" query is executing in 0.026 ms
(i.e. not as quickly as the slow query).  Since you mention that it
takes 7 s further down, I suspect this is not the real EXPLAIN ANALYZE
output on the real data that you're having a problem with.  You might
have better luck if you post the actual EXPLAIN ANALYZE output here.
Incidentally, sorry for not responding sooner to your private email -
I was on vacation last week.  But please do keep all replies on-list
so that everyone can comment.

All that having been said, I think the issue here is that the query
planner isn't inferring that d1.ID=<some constant> implies d2.ID=<some
constant>, even though there's a join clause d1.ID=d2.ID.  I'm not
really sure why it isn't doing that...  I suspect Tom Lane is the only
person who can comment intelligently on that, and he's away this week
(but if anyone else has an idea, feel free to jump in...).

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Query results differ depending on operating system (using GIN)
Следующее
От: David Fetter
Дата:
Сообщение: Re: sql/med review - problems with patching