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