Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9caf042

Browse files
committed
Reorder tests in get_cheapest_path_for_pathkeys().
Checking parallel safety should be even cheaper than cost comparison, sodo that first.Also make some minor, related comment improvements.Richard Guo, reviewed by Aleksander Alekseev, Andy Fan, and me.Discussion:http://postgr.es/m/CAMbWs4-KE2wf4QPj_Sr5mX4QFtBNNKGmxK=+e=KZEGUjdG33=g@mail.gmail.com
1 parentac22a95 commit9caf042

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/backend/optimizer/path/pathkeys.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ pathkeys_count_contained_in(List *keys1, List *keys2, int *n_common)
407407
/*
408408
* get_cheapest_path_for_pathkeys
409409
* Find the cheapest path (according to the specified criterion) that
410-
* satisfies the given pathkeys and parameterization.
410+
* satisfies the given pathkeys and parameterization, and is parallel-safe
411+
* if required.
411412
* Return NULL if no such path.
412413
*
413414
* 'paths' is a list of possible paths that all generate the same relation
@@ -429,6 +430,10 @@ get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
429430
{
430431
Path*path= (Path*)lfirst(l);
431432

433+
/* If required, reject paths that are not parallel-safe */
434+
if (require_parallel_safe&& !path->parallel_safe)
435+
continue;
436+
432437
/*
433438
* Since cost comparison is a lot cheaper than pathkey comparison, do
434439
* that first. (XXX is that still true?)
@@ -437,9 +442,6 @@ get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
437442
compare_path_costs(matched_path,path,cost_criterion) <=0)
438443
continue;
439444

440-
if (require_parallel_safe&& !path->parallel_safe)
441-
continue;
442-
443445
if (pathkeys_contained_in(pathkeys,path->pathkeys)&&
444446
bms_is_subset(PATH_REQ_OUTER(path),required_outer))
445447
matched_path=path;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp