Re: Aggregate and many LEFT JOIN

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: kimaidou <kimaidou(at)gmail(dot)com>
Cc: Michael Lewis <mlewis(at)entrata(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Aggregate and many LEFT JOIN
Date: 2019-02-26 13:51:34
Message-ID: 20190226135134.GS28750@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Feb 26, 2019 at 01:54:00PM +0100, kimaidou wrote:
> I manage to avoid the disk sort after performing a VACUUM ANALYSE;
> And with a session work_mem = '250MB'
>
> * SQL http://paste.debian.net/1070207/
> * EXPLAIN https://explain.depesz.com/s/nJ2y
>
> It stills spent 16s
> It seems this kind of query will need better hardware to scale...

Once you've exhausted other ideas, you could consider making that a TEMPORARY
TABLE, and creating an index on it (and analyzing it) and then aggregating.
It'd be several separate queries.

Justin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2019-02-26 13:52:29 Re: Aggregate and many LEFT JOIN
Previous Message kimaidou 2019-02-26 12:54:00 Re: Aggregate and many LEFT JOIN