Aggregate and many LEFT JOIN

From: kimaidou <kimaidou(at)gmail(dot)com>
To: postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Aggregate and many LEFT JOIN
Date: 2019-02-22 15:14:05
Message-ID: CAMKXKO6Ltz14uVgAyxy-cGSZoOQCbU5__2mjgVPv90snONZjNw@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 kimaidou 2019-02-22 15:36:33 Slow query with aggregate and many LEFT JOINS
Previous Message Gunther Schadow 2019-02-21 15:59:44 Re: neither CPU nor IO bound, but throttled performance