regress: query discrepancy between explain vs execution

Started by Matthias van de Meentabout 2 months ago5 messageshackers
Jump to latest
#1Matthias van de Meent
boekewurm@gmail.com

Hi,

In the partition_aggregate tests, there's a case where the explained
query doesn't match the query that's executed just below. This has
existed since the file was first committed (e2f1eb0ee3), and doesn't
materially affect the plan, but if any issues were introduced it might
not show up in this part of the test, so we should probably fix it.

Attached is a simple fix. I noticed the issue whilst debugging my
low-rowcount parallel scan costing efforts [0]/messages/by-id/CAEze2Wi+Jp26mhBJvrMshKGYNTtPcxzd1BWoEW_7+eH6saj3gQ@mail.gmail.com.

Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

[0]: /messages/by-id/CAEze2Wi+Jp26mhBJvrMshKGYNTtPcxzd1BWoEW_7+eH6saj3gQ@mail.gmail.com

Attachments:

t254035_1
v1-0001-regress-query-discrepancy-between-explain-vs-exec.patchapplication/octet-stream; name=v1-0001-regress-query-discrepancy-between-explain-vs-exec.patchDownload+4-4
#2Pierre Forstmann
pierre.forstmann@gmail.com
In reply to: Matthias van de Meent (#1)
Re: regress: query discrepancy between explain vs execution

The following review has been posted through the commitfest application:
make installcheck-world: tested, failed
Implements feature: tested, failed
Spec compliant: not tested
Documentation: not tested

Hello,

This patch looks good to me.

I don't think that there is a need to test spec. compliance or to test documentation.

Regards,
PF.

#3David Rowley
dgrowleyml@gmail.com
In reply to: Matthias van de Meent (#1)
Re: regress: query discrepancy between explain vs execution

On Sat, 3 Oct 2026 at 04:42, Matthias van de Meent <boekewurm@gmail.com> wrote:

In the partition_aggregate tests, there's a case where the explained
query doesn't match the query that's executed just below. This has
existed since the file was first committed (e2f1eb0ee3), and doesn't
materially affect the plan, but if any issues were introduced it might
not show up in this part of the test, so we should probably fix it.

I looked at this and noticed a couple more mistakes. Can you share why
you picked the HAVING query over the version without?

v2 attached with the other things I noticed. array_agg has supported
partial aggregation since v16 (16fd03e95).

David

Attachments:

t254035_3
v2_fix_partition_agg_tests.patchapplication/octet-stream; name=v2_fix_partition_agg_tests.patchDownload+12-6
#4Matthias van de Meent
boekewurm@gmail.com
In reply to: David Rowley (#3)
Re: regress: query discrepancy between explain vs execution

On Mon, 19 Oct 2026, 02:46 David Rowley, <dgrowleyml@gmail.com> wrote:

On Sat, 3 Oct 2026 at 04:42, Matthias van de Meent <boekewurm@gmail.com> wrote:

In the partition_aggregate tests, there's a case where the explained
query doesn't match the query that's executed just below. This has
existed since the file was first committed (e2f1eb0ee3), and doesn't
materially affect the plan, but if any issues were introduced it might
not show up in this part of the test, so we should probably fix it.

I looked at this and noticed a couple more mistakes. Can you share why
you picked the HAVING query over the version without?

Because that was more consistent with the rest of the queries in the
file. Every other explained-and-then-executed query on pagg_tab_ml
has a HAVING clause, except these.

v2 attached with the other things I noticed. array_agg has supported
partial aggregation since v16 (16fd03e95).

Thanks, LGTM.

Kind regards,

Matthias van de Meent
Databricks

#5David Rowley
dgrowleyml@gmail.com
In reply to: Matthias van de Meent (#4)
Re: regress: query discrepancy between explain vs execution

On Mon, 19 Oct 2026 at 23:03, Matthias van de Meent <boekewurm@gmail.com> wrote:

On Mon, 19 Oct 2026, 02:46 David Rowley, <dgrowleyml@gmail.com> wrote:

I looked at this and noticed a couple more mistakes. Can you share why
you picked the HAVING query over the version without?

Because that was more consistent with the rest of the queries in the
file. Every other explained-and-then-executed query on pagg_tab_ml
has a HAVING clause, except these.

Thanks for explaining.

v2 attached with the other things I noticed. array_agg has supported
partial aggregation since v16 (16fd03e95).

Thanks, LGTM.

Pushed. I did a back patch of this too, as this test file has really
not changed much since REL_14_STABLE, and I felt doing that might
reduce some future backpatching pain.

David