pgsql: Tidyup truncate_useless_pathkeys() function - Mailing list pgsql-committers

From David Rowley
Subject pgsql: Tidyup truncate_useless_pathkeys() function
Date
Msg-id E1vAEFF-002LxU-2d@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Tidyup truncate_useless_pathkeys() function

This removes a few static functions and replaces them with 2 functions
which aim to be more reusable.  The upper planner's pathkey requirements
can be simplified down to operations which require pathkeys in the same
order as the pathkeys for the given operation, and operations which can
make use of a Path's pathkeys in any order.

Here we also add some short-circuiting to truncate_useless_pathkeys().  At
any point we discover that all pathkeys are useful to a single operation,
we can stop checking the remaining operations as we're not going to be
able to find any further useful pathkeys - they're all possibly useful
already.  Adjusting this seems to warrant trying to put the checks
roughly in order of least-expensive-first so that the short-circuits
have the most chance of skipping the more expensive checks.

In passing clean up has_useful_pathkeys() as it seems to have grown a
redundant check for group_pathkeys.  This isn't needed as
standard_qp_callback will set query_pathkeys if there's any requirement
to have group_pathkeys.  All this code does is waste run-time effort and
take up needless space.

Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAApHDvpbsEoTksvW5901MMoZo-hHf78E5up3uDOfkJnxDe_WAw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e3b9e44689051d5bee199e333c748aac83396378

Modified Files
--------------
src/backend/optimizer/path/pathkeys.c | 213 +++++++++++++---------------------
1 file changed, 82 insertions(+), 131 deletions(-)


pgsql-committers by date:

Previous
From: Álvaro Herrera
Date:
Subject: pgsql: Fix determination of not-null constraint "locality" for inherite
Next
From: Tom Lane
Date:
Subject: pgsql: Allow role created by new test to log in on Windows.