38 .
name =
"tsm_system_rows",
120 !((
Const *) limitnode)->constisnull)
136 if (ntuples > baserel->
tuples)
143 double density = baserel->
tuples / (double) baserel->
pages;
145 npages = ntuples / density;
184 (
errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT),
185 errmsg(
"sample size must not be negative")));
187 sampler->
seed = seed;
215 if (sampler->
step == 0)
258 }
while (sampler->
lb >= nblocks);
291 if (tupoffset > maxoffset)
294 sampler->
lt = tupoffset;
339 }
while (r == 0 ||
gcd(r, n) > 1);
#define InvalidBlockNumber
Node * estimate_expression_value(PlannerInfo *root, Node *node)
double clamp_row_est(double nrows)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_RETURN_POINTER(x)
if(TABLE==NULL||TABLE_index==NULL)
void * palloc0(Size size)
#define CHECK_FOR_INTERRUPTS()
#define IsA(nodeptr, _type_)
#define InvalidOffsetNumber
#define FirstOffsetNumber
#define list_make1_oid(x1)
static int64 DatumGetInt64(Datum X)
double sampler_random_fract(pg_prng_state *randstate)
void sampler_random_init_state(uint32 seed, pg_prng_state *randstate)
NextSampleTuple_function NextSampleTuple
bool repeatable_across_scans
EndSampleScan_function EndSampleScan
SampleScanGetSampleSize_function SampleScanGetSampleSize
BeginSampleScan_function BeginSampleScan
NextSampleBlock_function NextSampleBlock
InitSampleScan_function InitSampleScan
bool repeatable_across_queries
static void system_rows_samplescangetsamplesize(PlannerInfo *root, RelOptInfo *baserel, List *paramexprs, BlockNumber *pages, double *tuples)
PG_FUNCTION_INFO_V1(tsm_system_rows_handler)
static void system_rows_initsamplescan(SampleScanState *node, int eflags)
static uint32 random_relative_prime(uint32 n, pg_prng_state *randstate)
static BlockNumber system_rows_nextsampleblock(SampleScanState *node, BlockNumber nblocks)
static uint32 gcd(uint32 a, uint32 b)
PG_MODULE_MAGIC_EXT(.name="tsm_system_rows",.version=PG_VERSION)
static void system_rows_beginsamplescan(SampleScanState *node, Datum *params, int nparams, uint32 seed)
Datum tsm_system_rows_handler(PG_FUNCTION_ARGS)
static OffsetNumber system_rows_nextsampletuple(SampleScanState *node, BlockNumber blockno, OffsetNumber maxoffset)