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

Commit34ca090

Browse files
committed
Adjust cost_merge_append() to reflect use of binaryheap_replace_first().
Commit7a2fe9b improved merge append so that replacement of a tupletakes log(N) operations, not twice log(N). Since cost_merge_append knewabout that explicitly, we should adjust it. This probably makes littledifference in practice, but the obsolete comment is confusing.Ideally this would have been put in in 9.3 with the underlying behaviorchange; but I'm not going to back-patch it, since there's some small chanceof changing a plan choice that somebody's optimized for.Thomas MunroDiscussion: <CAEepm=0WQBSvuYcMOUj4Ga4NXpu2J=ejZcE=e=eiTjTX-6_gDw@mail.gmail.com>
1 parent86d19d2 commit34ca090

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,7 @@ cost_sort(Path *path, PlannerInfo *root,
15771577
* at any given instant holds the next tuple from each stream. If there
15781578
* are N streams, we need about N*log2(N) tuple comparisons to construct
15791579
* the heap at startup, and then for each output tuple, about log2(N)
1580-
* comparisons to delete the top heap entry and another log2(N) comparisons
1581-
* to insert its successor from the same stream.
1580+
* comparisons to replace the top entry.
15821581
*
15831582
* (The effective value of N will drop once some of the input streams are
15841583
* exhausted, but it seems unlikely to be worth trying to account for that.)
@@ -1619,7 +1618,7 @@ cost_merge_append(Path *path, PlannerInfo *root,
16191618
startup_cost+=comparison_cost*N*logN;
16201619

16211620
/* Per-tuple heap maintenance cost */
1622-
run_cost+=tuples*comparison_cost*2.0*logN;
1621+
run_cost+=tuples*comparison_cost*logN;
16231622

16241623
/*
16251624
* Also charge a small amount (arbitrarily set equal to operator cost) per

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp