Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0161e52

Browse files
committed
Update reference to sampling algorithm in analyze.c
Commit 83e176e moved row sampling functions from analyze.c to utils/misc/sampling.c, but failed to update comment referring to the sampling algorithm from Jeff Vitter's paper. Correct the comment by pointing to utils/misc/sampling.c. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK154gp%2BQd%3DcorQOv%2BPmbyVyZBjp_%2Bhb766UJeD1e_ie6XQ%40mail.gmail.com
1 parent a559805 commit 0161e52

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/commands/analyze.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,13 +1173,13 @@ acquire_sample_rows(Relation onerel, int elevel,
11731173
* The first targrows sample rows are simply copied into the
11741174
* reservoir. Then we start replacing tuples in the sample
11751175
* until we reach the end of the relation. This algorithm is
1176-
* from Jeff Vitter's paper (see full citation below). It
1177-
* works by repeatedly computing the number of tuples to skip
1178-
* before selecting a tuple, which replaces a randomly chosen
1179-
* element of the reservoir (current set of tuples). At all
1180-
* times the reservoir is a true random sample of the tuples
1181-
* we've passed over so far, so when we fall off the end of
1182-
* the relation we're done.
1176+
* from Jeff Vitter's paper (see full citation in
1177+
* utils/misc/sampling.c). It works by repeatedly computing
1178+
* the number of tuples to skip before selecting a tuple,
1179+
* which replaces a randomly chosen element of the reservoir
1180+
* (current set of tuples). At all times the reservoir is a
1181+
* true random sample of the tuples we've passed over so far,
1182+
* so when we fall off the end of the relation we're done.
11831183
*/
11841184
if (numrows < targrows)
11851185
rows[numrows++] = heap_copytuple(&targtuple);

0 commit comments

Comments
 (0)