mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Update reference to sampling algorithm in analyze.c
Commit 83e176ec1 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
This commit is contained in:
parent
5329606693
commit
30e1b395c9
@ -1152,13 +1152,13 @@ acquire_sample_rows(Relation onerel, int elevel,
|
|||||||
* The first targrows sample rows are simply copied into the
|
* The first targrows sample rows are simply copied into the
|
||||||
* reservoir. Then we start replacing tuples in the sample
|
* reservoir. Then we start replacing tuples in the sample
|
||||||
* until we reach the end of the relation. This algorithm is
|
* until we reach the end of the relation. This algorithm is
|
||||||
* from Jeff Vitter's paper (see full citation below). It
|
* from Jeff Vitter's paper (see full citation in
|
||||||
* works by repeatedly computing the number of tuples to skip
|
* utils/misc/sampling.c). It works by repeatedly computing
|
||||||
* before selecting a tuple, which replaces a randomly chosen
|
* the number of tuples to skip before selecting a tuple,
|
||||||
* element of the reservoir (current set of tuples). At all
|
* which replaces a randomly chosen element of the reservoir
|
||||||
* times the reservoir is a true random sample of the tuples
|
* (current set of tuples). At all times the reservoir is a
|
||||||
* we've passed over so far, so when we fall off the end of
|
* true random sample of the tuples we've passed over so far,
|
||||||
* the relation we're done.
|
* so when we fall off the end of the relation we're done.
|
||||||
*/
|
*/
|
||||||
if (numrows < targrows)
|
if (numrows < targrows)
|
||||||
rows[numrows++] = heap_copytuple(&targtuple);
|
rows[numrows++] = heap_copytuple(&targtuple);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user