Re: Slow planning, fast execution for particular 3-table query

Поиск
Список
Период
Сортировка
От David Wheeler
Тема Re: Slow planning, fast execution for particular 3-table query
Дата
Msg-id 4E8A2B3E-7D59-4474-ADF1-DE454A174208@dgitsystems.com
обсуждение исходный текст
Ответ на Re: Slow planning, fast execution for particular 3-table query  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Slow planning, fast execution for particular 3-table query  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-performance
I'm not sure what "unusually large" is, but they're all < 1mb which is a little larger than some of our other
comparabledatabases (mostly <300kb) but seems reasonable to me. 
 

Regards, 
 
David

On 4/11/19, 3:37 pm, "Laurenz Albe" <laurenz.albe@cybertec.at> wrote:

    On Mon, 2019-11-04 at 03:04 +0000, David Wheeler wrote:
    > We’re having trouble working out why the planning time for this particular query is slow
    > (~2.5s vs 0.9ms execution time). As you can see below, there are only 3 tables involved
    > so it’s hard to imagine what decisions the planner has to make that take so long. After
    > 5 runs the prepared-statement code kicks in and it becomes quick, but it’s quite
    > infuriating for the first 5 runs given the execution is so much faster. 
    > 
    > Are you able to give any tips what might be taking so long (and how we might improve it)?
    > 
    [...]
    > Planning time: 2429.682 ms
    > 
    > Execution time: 0.914 ms
    
    Strange.
    Are any of your catalog tables unusually large?
    
    SELECT pg_relation_size(t.oid),
           t.relname
    FROM pg_class AS t
       JOIN pg_namespace AS n ON t.relnamespace = n.oid
    WHERE t.relkind = 'r'
    ORDER BY pg_relation_size(t.oid) DESC
    LIMIT 10;
    
    Yours,
    Laurenz Albe
    -- 
    Cybertec | https://www.cybertec-postgresql.com
    
    


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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: Slow planning, fast execution for particular 3-table query
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Slow planning, fast execution for particular 3-table query