Re: Slow Query - Postgres 9.2

Поиск
Список
Период
Сортировка
Искать
От
Vitaly Burovoy
Тема
Re: Slow Query - Postgres 9.2
Дата
Msg-id
CAKOSWN=OuOOBg_1R77qaa+tzD2UaFqLdFy=CdawB+qUbVnZrhA@mail.gmail.com
Ответ на
Slow Query - Postgres 9.2 (drum.lucas@gmail.com)
Список
Дерево обсуждения
Slow Query - Postgres 9.2 "drum.lucas@gmail.com" <drum.lucas@gmail.com>
Re: Slow Query - Postgres 9.2 Vitaly Burovoy <vitaly.burovoy@gmail.com>
Re: Slow Query - Postgres 9.2 "drum.lucas@gmail.com" <drum.lucas@gmail.com>
Re: Slow Query - Postgres 9.2 Vitaly Burovoy <vitaly.burovoy@gmail.com>
On 3/2/16, drum.lucas@gmail.com  wrote:
> Hi all...
>
> I'm working on a Slow Query. It's faster now (It was 20sec before) but
> still not good.
>
> Can you have a look and see if you can find something?
> Cheers
>
> Query:
>
> WITH jobs AS (
>     ...
>     FROM
>         jobs AS job
>     JOIN
>         public.ja_notes AS note
>         ON
>             note.jobid = job.id
>             AND note.note_type IN ('time', 'part')
>     ...

It is the most long part. All query is 8.8sec.
SeqScan by CTE is 2.8sec! and index scan in ix_notes_jobid_per_type
500rows(loops) * 9.878ms!!! = 4.939sec.

Why does it take so long time?
For example, index scan in ja_customers_pkey is only 0.781 per row...
10 times faster!

What definition of the ix_notes_jobid_per_type? Is it bloated?

> Explain analyze link: http://explain.depesz.com/s/IIDj
>


-- 
Best regards,
Vitaly Burovoy

В списке pgsql-general по дате отправления
От: Derek Elder
Дата:
От: Alvaro Herrera
Дата:
FAQ