From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | Kaimeh <kkaimeh(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Error when using array_agg with filter where clause in pg16 and pg17 |
Date: | 2025-04-09 00:25:54 |
Message-ID: | 90177.1744158354@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> On Wed, 9 Apr 2025 at 03:32, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> The simplest fix I can think of is to disable the presorted-agg
>> optimization if (1) there's a FILTER clause and (2) the proposed
>> sort key is anything more complex than a Var.
> Unfortunately, the situation is a little worse than what you
> highlighted, as I think I didn't consider FILTER at all, and this
> means I didn't consider the costing differences between filtering then
> sorting vs sorting then filtering.
Oooh. If the FILTER clause is selective, that could easily mean that
the "optimization" loses big from having to sort many more tuples.
I wonder if we should just not apply it when there's a FILTER,
full stop.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2025-04-09 00:43:53 | Re: Error when using array_agg with filter where clause in pg16 and pg17 |
Previous Message | David Rowley | 2025-04-08 23:55:55 | Re: Error when using array_agg with filter where clause in pg16 and pg17 |