Re: Slow SQL query (14-15 seconds)

От: Matthew Wakeling
Тема: Re: Slow SQL query (14-15 seconds)
Дата: ,
Msg-id: alpine.DEB.1.10.0811131321110.4666@aragorn.flymine.org
(см: обсуждение, исходный текст)
Ответ на: Slow SQL query (14-15 seconds)  (Bruno Baguette)
Ответы: Re: Slow SQL query (14-15 seconds)  (Bruno Baguette)
Список: pgsql-performance

Скрыть дерево обсуждения

Slow SQL query (14-15 seconds)  (Bruno Baguette, )
 Re: Slow SQL query (14-15 seconds)  (Matthew Wakeling, )
  Re: Slow SQL query (14-15 seconds)  (Bruno Baguette, )
 Re: Slow SQL query (14-15 seconds)  (Tom Lane, )
  Re: Slow SQL query (14-15 seconds)  (Bruno Baguette, )
   Re: Slow SQL query (14-15 seconds)  (Tom Lane, )
 Re: Slow SQL query (14-15 seconds)  (Tomasz Myrta, )
 Re: Slow SQL query (14-15 seconds)  ("Vladimir Sitnikov", )
  Re: Slow SQL query (14-15 seconds)  (Bruno Baguette, )

On Thu, 13 Nov 2008, Bruno Baguette wrote:
> I'm having a problem with this query (below) that takes between 14 and 15
> seconds to run, which is too long for the end-user.
>
> I've done a EXPLAIN ANALYZE (below below) but I'm having difficulties to see
> which part of that query is taking so many times.

As a general tip, if you're trying to work out which part of a query is
taking time, and the query is fairly obviously made up of several parts,
it would make sense to try them individually.

In any case, it appears that the time is being taken performing a full
index scan over the societe table, in one of the subqueries. Perhaps you
could run each of the subqueries individually, and send us the one that
takes loads of time as a simpler problem to solve.

Matthew

--
Those who do not understand Unix are condemned to reinvent it, poorly.
                -- Henry Spencer


В списке pgsql-performance по дате сообщения:

От: Bruno Baguette
Дата:
Сообщение: Re: Slow SQL query (14-15 seconds)
От: "Jeremiah Elliott"
Дата:
Сообщение: crosstab speed