SQL functions for random sampling.
More...
- See also
- For an overview of random-sampling functions, see the module description Random Sampling.
◆ gamma_random()
| float8 gamma_random |
( |
float8 |
alpha | ) |
|
◆ index_weighted_sample()
| integer index_weighted_sample |
( |
float8 |
[] | ) |
|
◆ poisson_random()
| integer poisson_random |
( |
float8 |
mean | ) |
|
◆ weighted_sample() [1/2]
| aggregate bytea8 weighted_sample |
( |
bigint |
value, |
|
|
float8 |
weight |
|
) |
| |
- Parameters
-
| value | Value of row. Uniqueness is not enforced. If a value occurs multiple times, the probability of sampling this value is proportional to the sum of its weights. |
| weight | Weight for row. A negative value here is treated has zero weight. |
- Returns
identifier of the selected row. The probability of sampling any particular row (value, weight) is weight/SUM(weight).
◆ weighted_sample() [2/2]
| aggregate bytea8 weighted_sample |
( |
float8 [] |
value, |
|
|
float8 |
weight |
|
) |
| |
◆ weighted_sample_final_int64()
| bigint weighted_sample_final_int64 |
( |
bytea8 |
state | ) |
|
◆ weighted_sample_final_vector()
| float8 [] weighted_sample_final_vector |
( |
bytea8 |
state | ) |
|
◆ weighted_sample_merge_int64()
| bytea8 weighted_sample_merge_int64 |
( |
bytea8 |
state_left, |
|
|
bytea8 |
state_right |
|
) |
| |
◆ weighted_sample_merge_vector()
| bytea8 weighted_sample_merge_vector |
( |
bytea8 |
state_left, |
|
|
bytea8 |
state_right |
|
) |
| |
◆ weighted_sample_transition_int64()
| bytea8 weighted_sample_transition_int64 |
( |
bytea8 |
state, |
|
|
bigint |
value, |
|
|
float8 |
weight |
|
) |
| |
◆ weighted_sample_transition_vector()
| bytea8 weighted_sample_transition_vector |
( |
bytea8 |
state, |
|
|
float8 [] |
value, |
|
|
float8 |
weight |
|
) |
| |