Thank you for feedback and thread [1].
Regards,
Damir Belyalov
Postgres Professional
>
>
> I don't think this is a good way to do this. The method you're using
> only supports this optimisation when querying a table directly. If
> there were subqueries, joins, etc then it wouldn't work as there are
> no unique indexes. You should probably have a look at [1] to see
> further deta
On Thu, 14 Sept 2023 at 02:28, Damir Belyalov wrote:
> create table a (n int);
> insert into a (n) select x from generate_series(1, 14) as g(x);
> create unique index on a (n);
> explain select distinct n from a;
> QUERY PLAN
> -
> On 13 Sep 2023, at 15:22, Damir Belyalov wrote:
> There is a table with a unique index on it and we have a query that searching
> DISTINCT values on this table on columns of unique index.
> We can see that Unique node is redundant for this case. So I implemented a
> simple patch that removes