Slow query with aggregate and many LEFT JOINS - Mailing list pgsql-performance

From kimaidou
Subject Slow query with aggregate and many LEFT JOINS
Date
Msg-id CAMKXKO7NSKdRqoUA582kwK2nprf4NLQ4r+ZXS9vhBh5gPwwLQg@mail.gmail.com
Whole thread Raw
Responses RE: Slow query with aggregate and many LEFT JOINS  (Igor Neyman <ineyman@perceptron.com>)
List 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

pgsql-performance by date:

Previous
From: kimaidou
Date:
Subject: Aggregate and many LEFT JOIN
Next
From: Justin Pryzby
Date:
Subject: Re: Aggregate and many LEFT JOIN