Slow query with aggregate and many LEFT JOINS

From: kimaidou <kimaidou(at)gmail(dot)com>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Slow query with aggregate and many LEFT JOINS
Date: 2019-02-22 15:36:33
Message-ID: CAMKXKO7NSKdRqoUA582kwK2nprf4NLQ4r+ZXS9vhBh5gPwwLQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi all,

I need to optimize the following query
http://paste.debian.net/hidden/ef08f864/
I use it to create a materialized view, but I think there is room for
optimization.
I tried to
SET join_collapse_limit TO 15;
with to real difference.

Explain shows that the GROUP AGGREGATE and needed sort kill the performance.
Do you have any hint how to optimize this ?
https://explain.depesz.com/s/6nf

Regards
Michaël

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2019-02-22 15:54:15 Re: Aggregate and many LEFT JOIN
Previous Message kimaidou 2019-02-22 15:14:05 Aggregate and many LEFT JOIN