From: | David Rowley <drowley(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Simplify PathKey checking code |
Date: | 2024-02-15 05:01:44 |
Message-ID: | E1raTsW-006IvK-P5@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Simplify PathKey checking code
pathkeys_useful_for_ordering() contained some needless checks to return
0 when either root->query_pathkeys or pathkeys lists were empty. This is
already handled by pathkeys_count_contained_in(), so let's have it do the
work instead of having redundant checks.
Similarly, in pathkeys_useful_for_grouping(), checking pathkeys is an
empty list just before looping over it isn't required. Technically,
neither is the list empty check for group_pathkeys, but I felt a bit
more work would have to be done to get the equivalent behavior if we'd
left it up to the foreach loop to call list_member_ptr().
This was noticed by Andy while he was reviewing a patch to improve the
UNION planner. Since that patch adds another function similar to
pathkeys_useful_for_ordering() and since I wasn't planning to copy these
redundant checks over to the new function, let's adjust the existing
code so that both functions will be consistent.
Author: Andy Fan
Discussion: https://postgr.es/m/87o7cti48f.fsf@163.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0c444a70f2a79d4d7ef6f1af057909839e5b2097
Modified Files
--------------
src/backend/optimizer/path/pathkeys.c | 10 ----------
1 file changed, 10 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2024-02-15 05:22:24 | pgsql: Another try to fix BF failure introduced in commit ddd5f4f54a. |
Previous Message | David Rowley | 2024-02-15 00:13:50 | pgsql: Clarify the 'rows' parameter in create_append_path |