From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | Zhang Mingli <zmlpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Remove useless GROUP BY columns considering unique index |
Date: | 2024-11-28 12:33:07 |
Message-ID: | CACJufxENUcVLs0qmpG0JOV7KmDNYQY_qOMQqh_VwOct-SL0ovg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Nov 28, 2024 at 2:11 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> I think it'll make more sense to adjust some of the
> existing tests to use a unique constraint instead of a PK and then
> adjust a column's NOT NULL property to check that part of the code is
> working correctly.
>
looking around, i inserted some tests to indexing.sql,
create_index.sql, aggregates.sql
also added tests for sort by index oid.
> Another issue with this is that the list of indexes being used is not
> sorted by Oid. If you look at RelationGetIndexList() you'll see that
> we perform a sort. That gives us more consistency in the planner. I
> think this patch should be doing that too, otherwise, you could end up
> with a plan change after some operation that changes the order that
> the indexes are stored in the pg_index table. It's probably fairly
> unlikely, but it is the sort of issue that someone will eventually
> discover and report.
>
Thanks for the tip!
I have wondered about multiple matches, simply choosing the first one
may have some surprise results.
i didn't know that in some cases we use list_sort to make the result
more deterministic.
When there are multiple matches, we need a determined way to choose which one.
so please check attached.
Attachment | Content-Type | Size |
---|---|---|
v6-0001-remove-useless-group-by-columns-via-unique-not-nu.patch | text/x-patch | 18.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bertrand Drouvot | 2024-11-28 13:39:21 | Re: Make pg_stat_io view count IOs as bytes instead of blocks |
Previous Message | Alvaro Herrera | 2024-11-28 12:16:18 | crash with synchronized_standby_slots |