Re: Apparent missed query optimization with self-join and inner grouping

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Zack Weinberg <zackw(at)panix(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Apparent missed query optimization with self-join and inner grouping
Date: 2020-08-01 17:02:52
Message-ID: CAHOFxGqpP72wNVX7KdvFHRXARsiBA6AN-N+fZfafah+uocgV_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Subqueries are evaluated separately when they include an aggregate or
window function as I understand it. I agree that it would be helpful in
your case if that outside qual was pushed inside.

I assume this query is generated by an ORM and you don't just have the
option to simply change it?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Curt Kolovson 2020-08-01 17:35:37 how reliable is pg_rewind?
Previous Message Ben Chobot 2020-08-01 16:58:05 Re: 12.3 replicas falling over during WAL redo