MCPcopy Create free account
hub / github.com/apache/cloudberry / pathkeys_useful_for_ordering

Function pathkeys_useful_for_ordering

src/backend/optimizer/path/pathkeys.c:2452–2467  ·  view source on GitHub ↗

* pathkeys_useful_for_ordering * Count the number of pathkeys that are useful for meeting the * query's requested output ordering. * * Because we the have the possibility of incremental sort, a prefix list of * keys is potentially useful for improving the performance of the requested * ordering. Thus we return 0, if no valuable keys are found, or the number * of leading keys shared by the

Source from the content-addressed store, hash-verified

2450 * of leading keys shared by the list and the requested ordering..
2451 */
2452static int
2453pathkeys_useful_for_ordering(PlannerInfo *root, List *pathkeys)
2454{
2455 int n_common_pathkeys;
2456
2457 if (root->query_pathkeys == NIL)
2458 return 0; /* no special ordering requested */
2459
2460 if (pathkeys == NIL)
2461 return 0; /* unordered path */
2462
2463 (void) pathkeys_count_contained_in(root->query_pathkeys, pathkeys,
2464 &n_common_pathkeys);
2465
2466 return n_common_pathkeys;
2467}
2468
2469/*
2470 * truncate_useless_pathkeys

Callers 1

Calls 1

Tested by

no test coverage detected