Re: extremely slow planner when DISTINCT clause holds more columns

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: extremely slow planner when DISTINCT clause holds more columns
Date: 2026-11-30 13:34:21
Message-ID: CAFj8pRCY2YBA59KZeTjzmJQfcHa75_--i8SJE5EaH3mSOc0FLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

i rechecked this test on Postgres compiled without asserts, and the
overhead of DISTINCT is not too strong, but still it is visible

cca 3ms x 0.5 ms. There is dependency on the number of columns - the real
slow query has 220 columns in the DISTINCT clause and planning is about 50
ms.

I tested pg13 - master and the overhead is visible on all versions

Regards

Pavel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-11-30 13:39:08 Re: ABI Compliance Checker GSoC Project
Previous Message Peter Eisentraut 2026-11-30 13:22:42 Re: pg_rewind: Fix buffer size passed when building WAL file name