PostgreSQL Source Code git master
Loading...
Searching...
No Matches
attribute_stats.c File Reference
#include "postgres.h"
#include "access/heapam.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/pg_operator.h"
#include "nodes/makefuncs.h"
#include "statistics/statistics.h"
#include "statistics/stat_utils.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
Include dependency graph for attribute_stats.c:

Go to the source code of this file.

Enumerations

enum  attribute_stats_argnum {
  ATTRELSCHEMA_ARG = 0 , ATTRELNAME_ARG , ATTNAME_ARG , ATTNUM_ARG ,
  INHERITED_ARG , NULL_FRAC_ARG , AVG_WIDTH_ARG , N_DISTINCT_ARG ,
  MOST_COMMON_VALS_ARG , MOST_COMMON_FREQS_ARG , HISTOGRAM_BOUNDS_ARG , CORRELATION_ARG ,
  MOST_COMMON_ELEMS_ARG , MOST_COMMON_ELEM_FREQS_ARG , ELEM_COUNT_HISTOGRAM_ARG , RANGE_LENGTH_HISTOGRAM_ARG ,
  RANGE_EMPTY_FRAC_ARG , RANGE_BOUNDS_HISTOGRAM_ARG , NUM_ATTRIBUTE_STATS_ARGS
}
 
enum  clear_attribute_stats_argnum {
  C_ATTRELSCHEMA_ARG = 0 , C_ATTRELNAME_ARG , C_ATTNAME_ARG , C_INHERITED_ARG ,
  C_NUM_ATTRIBUTE_STATS_ARGS
}
 

Functions

static bool attribute_statistics_update (FunctionCallInfo fcinfo)
 
static void upsert_pg_statistic (Relation starel, HeapTuple oldtup, const Datum *values, const bool *nulls, const bool *replaces)
 
static bool delete_pg_statistic (Oid reloid, AttrNumber attnum, bool stainherit)
 
Datum pg_clear_attribute_stats (PG_FUNCTION_ARGS)
 
Datum pg_restore_attribute_stats (PG_FUNCTION_ARGS)
 

Variables

static struct StatsArgInfo attarginfo []
 
static struct StatsArgInfo cleararginfo []
 

Enumeration Type Documentation

◆ attribute_stats_argnum

Enumerator
ATTRELSCHEMA_ARG 
ATTRELNAME_ARG 
ATTNAME_ARG 
ATTNUM_ARG 
INHERITED_ARG 
NULL_FRAC_ARG 
AVG_WIDTH_ARG 
N_DISTINCT_ARG 
MOST_COMMON_VALS_ARG 
MOST_COMMON_FREQS_ARG 
HISTOGRAM_BOUNDS_ARG 
CORRELATION_ARG 
MOST_COMMON_ELEMS_ARG 
MOST_COMMON_ELEM_FREQS_ARG 
ELEM_COUNT_HISTOGRAM_ARG 
RANGE_LENGTH_HISTOGRAM_ARG 
RANGE_EMPTY_FRAC_ARG 
RANGE_BOUNDS_HISTOGRAM_ARG 
NUM_ATTRIBUTE_STATS_ARGS 

Definition at line 38 of file attribute_stats.c.

39{
59};
@ ATTNUM_ARG
@ RANGE_LENGTH_HISTOGRAM_ARG
@ RANGE_BOUNDS_HISTOGRAM_ARG
@ ATTRELSCHEMA_ARG
@ AVG_WIDTH_ARG
@ INHERITED_ARG
@ ATTRELNAME_ARG
@ MOST_COMMON_ELEMS_ARG
@ NULL_FRAC_ARG
@ NUM_ATTRIBUTE_STATS_ARGS
@ MOST_COMMON_FREQS_ARG
@ CORRELATION_ARG
@ HISTOGRAM_BOUNDS_ARG
@ MOST_COMMON_VALS_ARG
@ RANGE_EMPTY_FRAC_ARG
@ ELEM_COUNT_HISTOGRAM_ARG
@ ATTNAME_ARG
@ N_DISTINCT_ARG
@ MOST_COMMON_ELEM_FREQS_ARG

◆ clear_attribute_stats_argnum

Enumerator
C_ATTRELSCHEMA_ARG 
C_ATTRELNAME_ARG 
C_ATTNAME_ARG 
C_INHERITED_ARG 
C_NUM_ATTRIBUTE_STATS_ARGS 

Definition at line 89 of file attribute_stats.c.

90{
96};
@ C_INHERITED_ARG
@ C_NUM_ATTRIBUTE_STATS_ARGS
@ C_ATTNAME_ARG
@ C_ATTRELNAME_ARG
@ C_ATTRELSCHEMA_ARG

Function Documentation

◆ attribute_statistics_update()

static bool attribute_statistics_update ( FunctionCallInfo  fcinfo)
static

Definition at line 129 of file attribute_stats.c.

130{
131 char *nspname;
132 char *relname;
133 Oid reloid;
134 char *attname;
136 bool inherited;
138
141
143 int32 atttypmod;
144 char atttyptype;
146 Oid eq_opr = InvalidOid;
147 Oid lt_opr = InvalidOid;
148
151
153
164
166 bool nulls[Natts_pg_statistic] = {0};
167 bool replaces[Natts_pg_statistic] = {0};
168
169 bool result = true;
170
173
176
177 if (RecoveryInProgress())
180 errmsg("recovery is in progress"),
181 errhint("Statistics cannot be modified during recovery.")));
182
183 /* lock before looking up attribute */
184 reloid = RangeVarGetRelidExtended(makeRangeVar(nspname, relname, -1),
187
188 /* user can specify either attname or attnum, but not both */
190 {
194 errmsg("cannot specify both \"%s\" and \"%s\"", "attname", "attnum")));
196 attnum = get_attnum(reloid, attname);
197 /* note that this test covers attisdropped cases too: */
201 errmsg("column \"%s\" of relation \"%s\" does not exist",
202 attname, relname)));
203 }
204 else if (!PG_ARGISNULL(ATTNUM_ARG))
205 {
207 attname = get_attname(reloid, attnum, true);
208 /* annoyingly, get_attname doesn't check attisdropped */
209 if (attname == NULL ||
213 errmsg("column %d of relation \"%s\" does not exist",
214 attnum, relname)));
215 }
216 else
217 {
220 errmsg("must specify either \"%s\" or \"%s\"", "attname", "attnum")));
221 attname = NULL; /* keep compiler quiet */
222 attnum = 0;
223 }
224
225 if (attnum < 0)
228 errmsg("cannot modify statistics on system column \"%s\"",
229 attname)));
230
233
234 /*
235 * Check argument sanity. If some arguments are unusable, emit a WARNING
236 * and set the corresponding argument to NULL in fcinfo.
237 */
238
240 {
241 do_mcv = false;
242 result = false;
243 }
244
246 {
247 do_mcelem = false;
248 result = false;
249 }
251 {
252 do_dechist = false;
253 result = false;
254 }
255
256 if (!stats_check_arg_pair(fcinfo, attarginfo,
258 {
259 do_mcv = false;
260 result = false;
261 }
262
263 if (!stats_check_arg_pair(fcinfo, attarginfo,
266 {
267 do_mcelem = false;
268 result = false;
269 }
270
271 if (!stats_check_arg_pair(fcinfo, attarginfo,
274 {
276 result = false;
277 }
278
279 /* derive information from attribute */
280 statatt_get_type(reloid, attnum,
281 &atttypid, &atttypmod,
283 &eq_opr, &lt_opr);
284
285 /* if needed, derive element type */
286 if (do_mcelem || do_dechist)
287 {
290 {
292 (errmsg("could not determine element type of column \"%s\"", attname),
293 errdetail("Cannot set %s or %s.",
294 "STATISTIC_KIND_MCELEM", "STATISTIC_KIND_DECHIST")));
297
298 do_mcelem = false;
299 do_dechist = false;
300 result = false;
301 }
302 }
303
304 /* histogram and correlation require less-than operator */
305 if ((do_histogram || do_correlation) && !OidIsValid(lt_opr))
306 {
309 errmsg("could not determine less-than operator for column \"%s\"", attname),
310 errdetail("Cannot set %s or %s.",
311 "STATISTIC_KIND_HISTOGRAM", "STATISTIC_KIND_CORRELATION")));
312
313 do_histogram = false;
314 do_correlation = false;
315 result = false;
316 }
317
318 /* only range types can have range stats */
321 {
324 errmsg("column \"%s\" is not a range type", attname),
325 errdetail("Cannot set %s or %s.",
326 "STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM", "STATISTIC_KIND_BOUNDS_HISTOGRAM")));
327
328 do_bounds_histogram = false;
330 result = false;
331 }
332
334
336
338
339 /* initialize from existing tuple if exists */
342 else
344 replaces);
345
346 /* if specified, set to argument values */
348 {
351 }
353 {
356 }
358 {
361 }
362
363 /* STATISTIC_KIND_MCV */
364 if (do_mcv)
365 {
366 bool converted;
368 Datum stavalues = statatt_build_stavalues("most_common_vals",
371 atttypid, atttypmod,
372 &converted);
373
374 if (converted)
375 {
378 eq_opr, atttypcoll,
379 stanumbers, false, stavalues, false);
380 }
381 else
382 result = false;
383 }
384
385 /* STATISTIC_KIND_HISTOGRAM */
386 if (do_histogram)
387 {
388 Datum stavalues;
389 bool converted = false;
390
391 stavalues = statatt_build_stavalues("histogram_bounds",
394 atttypid, atttypmod,
395 &converted);
396
397 if (converted)
398 {
401 lt_opr, atttypcoll,
402 0, true, stavalues, false);
403 }
404 else
405 result = false;
406 }
407
408 /* STATISTIC_KIND_CORRELATION */
409 if (do_correlation)
410 {
413 Datum stanumbers = PointerGetDatum(arry);
414
417 lt_opr, atttypcoll,
418 stanumbers, false, 0, true);
419 }
420
421 /* STATISTIC_KIND_MCELEM */
422 if (do_mcelem)
423 {
425 bool converted = false;
426 Datum stavalues;
427
428 stavalues = statatt_build_stavalues("most_common_elems",
431 elemtypid, atttypmod,
432 &converted);
433
434 if (converted)
435 {
439 stanumbers, false, stavalues, false);
440 }
441 else
442 result = false;
443 }
444
445 /* STATISTIC_KIND_DECHIST */
446 if (do_dechist)
447 {
449
453 stanumbers, false, 0, true);
454 }
455
456 /*
457 * STATISTIC_KIND_BOUNDS_HISTOGRAM
458 *
459 * This stakind appears before STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM even
460 * though it is numerically greater, and all other stakinds appear in
461 * numerical order. We duplicate this quirk for consistency.
462 */
464 {
465 bool converted = false;
466 Datum stavalues;
467
468 stavalues = statatt_build_stavalues("range_bounds_histogram",
471 atttypid, atttypmod,
472 &converted);
473
474 if (converted)
475 {
479 0, true, stavalues, false);
480 }
481 else
482 result = false;
483 }
484
485 /* STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM */
487 {
488 /* The anyarray is always a float8[] for this stakind */
491 Datum stanumbers = PointerGetDatum(arry);
492
493 bool converted = false;
494 Datum stavalues;
495
496 stavalues = statatt_build_stavalues("range_length_histogram",
499 FLOAT8OID, 0, &converted);
500
501 if (converted)
502 {
506 stanumbers, false, stavalues, false);
507 }
508 else
509 result = false;
510 }
511
513
517
518 return result;
519}
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
int16 AttrNumber
Definition attnum.h:21
#define InvalidAttrNumber
Definition attnum.h:23
static void upsert_pg_statistic(Relation starel, HeapTuple oldtup, const Datum *values, const bool *nulls, const bool *replaces)
static struct StatsArgInfo attarginfo[]
static Datum values[MAXATTR]
Definition bootstrap.c:155
#define TextDatumGetCString(d)
Definition builtins.h:98
int32_t int32
Definition c.h:542
#define OidIsValid(objectId)
Definition c.h:788
int errdetail(const char *fmt,...)
Definition elog.c:1216
int errhint(const char *fmt,...)
Definition elog.c:1330
int errcode(int sqlerrcode)
Definition elog.c:863
int errmsg(const char *fmt,...)
Definition elog.c:1080
#define WARNING
Definition elog.h:36
#define ERROR
Definition elog.h:39
#define ereport(elevel,...)
Definition elog.h:150
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition fmgr.c:128
#define PG_ARGISNULL(n)
Definition fmgr.h:209
#define PG_GETARG_DATUM(n)
Definition fmgr.h:268
#define PG_GETARG_BOOL(n)
Definition fmgr.h:274
#define PG_GETARG_INT16(n)
Definition fmgr.h:271
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Definition heaptuple.c:1346
#define HeapTupleIsValid(tuple)
Definition htup.h:78
#define ShareUpdateExclusiveLock
Definition lockdefs.h:39
#define RowExclusiveLock
Definition lockdefs.h:38
AttrNumber get_attnum(Oid relid, const char *attname)
Definition lsyscache.c:934
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
Definition lsyscache.c:903
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition makefuncs.c:473
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
Definition namespace.c:440
NameData attname
int16 attnum
NameData relname
Definition pg_class.h:38
static Datum PointerGetDatum(const void *X)
Definition postgres.h:352
static Datum Int16GetDatum(int16 X)
Definition postgres.h:182
static Datum BoolGetDatum(bool X)
Definition postgres.h:112
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:262
uint64_t Datum
Definition postgres.h:70
#define InvalidOid
unsigned int Oid
static int fb(int x)
#define RelationGetDescr(relation)
Definition rel.h:540
bool statatt_get_elem_type(Oid atttypid, char atttyptype, Oid *elemtypid, Oid *elem_eq_opr)
Definition stat_utils.c:523
Datum statatt_build_stavalues(const char *staname, FmgrInfo *array_in, Datum d, Oid typid, int32 typmod, bool *ok)
Definition stat_utils.c:567
void RangeVarCallbackForStats(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition stat_utils.c:142
void statatt_init_empty_tuple(Oid reloid, int16 attnum, bool inherited, Datum *values, bool *nulls, bool *replaces)
Definition stat_utils.c:713
bool stats_check_arg_array(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
Definition stat_utils.c:70
void statatt_get_type(Oid reloid, AttrNumber attnum, Oid *atttypid, int32 *atttypmod, char *atttyptype, Oid *atttypcoll, Oid *eq_opr, Oid *lt_opr)
Definition stat_utils.c:437
void stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
Definition stat_utils.c:51
void statatt_set_slot(Datum *values, bool *nulls, bool *replaces, int16 stakind, Oid staop, Oid stacoll, Datum stanumbers, bool stanumbers_isnull, Datum stavalues, bool stavalues_isnull)
Definition stat_utils.c:635
bool stats_check_arg_pair(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum1, int argnum2)
Definition stat_utils.c:111
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:264
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
Definition syscache.c:240
bool SearchSysCacheExistsAttName(Oid relid, const char *attname)
Definition syscache.c:517
void table_close(Relation relation, LOCKMODE lockmode)
Definition table.c:126
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition table.c:40
bool RecoveryInProgress(void)
Definition xlog.c:6460

References attarginfo, attname, ATTNAME_ARG, attnum, ATTNUM_ARG, ATTRELNAME_ARG, ATTRELSCHEMA_ARG, AVG_WIDTH_ARG, BoolGetDatum(), construct_array_builtin(), CORRELATION_ARG, ELEM_COUNT_HISTOGRAM_ARG, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, fb(), fmgr_info(), get_attname(), get_attnum(), heap_deform_tuple(), HeapTupleIsValid, HISTOGRAM_BOUNDS_ARG, INHERITED_ARG, Int16GetDatum(), InvalidAttrNumber, InvalidOid, makeRangeVar(), MOST_COMMON_ELEM_FREQS_ARG, MOST_COMMON_ELEMS_ARG, MOST_COMMON_FREQS_ARG, MOST_COMMON_VALS_ARG, N_DISTINCT_ARG, NULL_FRAC_ARG, ObjectIdGetDatum(), OidIsValid, PG_ARGISNULL, PG_GETARG_BOOL, PG_GETARG_DATUM, PG_GETARG_INT16, PointerGetDatum(), RANGE_BOUNDS_HISTOGRAM_ARG, RANGE_EMPTY_FRAC_ARG, RANGE_LENGTH_HISTOGRAM_ARG, RangeVarCallbackForStats(), RangeVarGetRelidExtended(), RecoveryInProgress(), RelationGetDescr, ReleaseSysCache(), relname, RowExclusiveLock, SearchSysCache3(), SearchSysCacheExistsAttName(), ShareUpdateExclusiveLock, statatt_build_stavalues(), statatt_get_elem_type(), statatt_get_type(), statatt_init_empty_tuple(), statatt_set_slot(), stats_check_arg_array(), stats_check_arg_pair(), stats_check_required_arg(), table_close(), table_open(), TextDatumGetCString, upsert_pg_statistic(), values, and WARNING.

Referenced by pg_restore_attribute_stats().

◆ delete_pg_statistic()

static bool delete_pg_statistic ( Oid  reloid,
AttrNumber  attnum,
bool  stainherit 
)
static

Definition at line 551 of file attribute_stats.c.

552{
555 bool result = false;
556
557 /* Is there already a pg_statistic tuple for this attribute? */
559 ObjectIdGetDatum(reloid),
562
564 {
565 CatalogTupleDelete(sd, &oldtup->t_self);
567 result = true;
568 }
569
571
573
574 return result;
575}
void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
Definition indexing.c:365
void CommandCounterIncrement(void)
Definition xact.c:1101

References attnum, BoolGetDatum(), CatalogTupleDelete(), CommandCounterIncrement(), fb(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), RowExclusiveLock, SearchSysCache3(), table_close(), and table_open().

Referenced by pg_clear_attribute_stats().

◆ pg_clear_attribute_stats()

Datum pg_clear_attribute_stats ( PG_FUNCTION_ARGS  )

Definition at line 581 of file attribute_stats.c.

582{
583 char *nspname;
584 char *relname;
585 Oid reloid;
586 char *attname;
588 bool inherited;
590
595
598
599 if (RecoveryInProgress())
602 errmsg("recovery is in progress"),
603 errhint("Statistics cannot be modified during recovery.")));
604
605 reloid = RangeVarGetRelidExtended(makeRangeVar(nspname, relname, -1),
608
610 attnum = get_attnum(reloid, attname);
611
612 if (attnum < 0)
615 errmsg("cannot clear statistics on system column \"%s\"",
616 attname)));
617
621 errmsg("column \"%s\" of relation \"%s\" does not exist",
622 attname, get_rel_name(reloid))));
623
625
628}
static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit)
static struct StatsArgInfo cleararginfo[]
#define PG_RETURN_VOID()
Definition fmgr.h:350
char * get_rel_name(Oid relid)
Definition lsyscache.c:2078

References attname, attnum, C_ATTNAME_ARG, C_ATTRELNAME_ARG, C_ATTRELSCHEMA_ARG, C_INHERITED_ARG, cleararginfo, delete_pg_statistic(), ereport, errcode(), errhint(), errmsg(), ERROR, fb(), get_attnum(), get_rel_name(), InvalidAttrNumber, InvalidOid, makeRangeVar(), PG_GETARG_BOOL, PG_GETARG_DATUM, PG_RETURN_VOID, RangeVarCallbackForStats(), RangeVarGetRelidExtended(), RecoveryInProgress(), relname, ShareUpdateExclusiveLock, stats_check_required_arg(), and TextDatumGetCString.

◆ pg_restore_attribute_stats()

Datum pg_restore_attribute_stats ( PG_FUNCTION_ARGS  )

Definition at line 657 of file attribute_stats.c.

658{
660 bool result = true;
661
664
666 attarginfo))
667 result = false;
668
670 result = false;
671
672 PG_RETURN_BOOL(result);
673}
static bool attribute_statistics_update(FunctionCallInfo fcinfo)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
Definition fmgr.h:150
#define LOCAL_FCINFO(name, nargs)
Definition fmgr.h:110
#define PG_RETURN_BOOL(x)
Definition fmgr.h:360
bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo, FunctionCallInfo positional_fcinfo, struct StatsArgInfo *arginfo)
Definition stat_utils.c:348

References attarginfo, attribute_statistics_update(), fb(), InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, NUM_ATTRIBUTE_STATS_ARGS, PG_RETURN_BOOL, and stats_fill_fcinfo_from_arg_pairs().

◆ upsert_pg_statistic()

static void upsert_pg_statistic ( Relation  starel,
HeapTuple  oldtup,
const Datum values,
const bool nulls,
const bool replaces 
)
static

Definition at line 525 of file attribute_stats.c.

527{
529
531 {
533 values, nulls, replaces);
535 }
536 else
537 {
540 }
541
543
545}
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
Definition heaptuple.c:1210
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
Definition heaptuple.c:1117
void heap_freetuple(HeapTuple htup)
Definition heaptuple.c:1435
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
Definition indexing.c:313
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
Definition indexing.c:233

References CatalogTupleInsert(), CatalogTupleUpdate(), CommandCounterIncrement(), fb(), heap_form_tuple(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, RelationGetDescr, and values.

Referenced by attribute_statistics_update().

Variable Documentation

◆ attarginfo

struct StatsArgInfo attarginfo[]
static
Initial value:
=
{
[ATTRELSCHEMA_ARG] = {"schemaname", TEXTOID},
[ATTRELNAME_ARG] = {"relname", TEXTOID},
[ATTNAME_ARG] = {"attname", TEXTOID},
[ATTNUM_ARG] = {"attnum", INT2OID},
[INHERITED_ARG] = {"inherited", BOOLOID},
[NULL_FRAC_ARG] = {"null_frac", FLOAT4OID},
[AVG_WIDTH_ARG] = {"avg_width", INT4OID},
[N_DISTINCT_ARG] = {"n_distinct", FLOAT4OID},
[MOST_COMMON_VALS_ARG] = {"most_common_vals", TEXTOID},
[MOST_COMMON_FREQS_ARG] = {"most_common_freqs", FLOAT4ARRAYOID},
[HISTOGRAM_BOUNDS_ARG] = {"histogram_bounds", TEXTOID},
[CORRELATION_ARG] = {"correlation", FLOAT4OID},
[MOST_COMMON_ELEMS_ARG] = {"most_common_elems", TEXTOID},
[MOST_COMMON_ELEM_FREQS_ARG] = {"most_common_elem_freqs", FLOAT4ARRAYOID},
[ELEM_COUNT_HISTOGRAM_ARG] = {"elem_count_histogram", FLOAT4ARRAYOID},
[RANGE_LENGTH_HISTOGRAM_ARG] = {"range_length_histogram", TEXTOID},
[RANGE_EMPTY_FRAC_ARG] = {"range_empty_frac", FLOAT4OID},
[RANGE_BOUNDS_HISTOGRAM_ARG] = {"range_bounds_histogram", TEXTOID},
}

Definition at line 61 of file attribute_stats.c.

62{
63 [ATTRELSCHEMA_ARG] = {"schemaname", TEXTOID},
64 [ATTRELNAME_ARG] = {"relname", TEXTOID},
65 [ATTNAME_ARG] = {"attname", TEXTOID},
66 [ATTNUM_ARG] = {"attnum", INT2OID},
67 [INHERITED_ARG] = {"inherited", BOOLOID},
68 [NULL_FRAC_ARG] = {"null_frac", FLOAT4OID},
69 [AVG_WIDTH_ARG] = {"avg_width", INT4OID},
70 [N_DISTINCT_ARG] = {"n_distinct", FLOAT4OID},
71 [MOST_COMMON_VALS_ARG] = {"most_common_vals", TEXTOID},
72 [MOST_COMMON_FREQS_ARG] = {"most_common_freqs", FLOAT4ARRAYOID},
73 [HISTOGRAM_BOUNDS_ARG] = {"histogram_bounds", TEXTOID},
74 [CORRELATION_ARG] = {"correlation", FLOAT4OID},
75 [MOST_COMMON_ELEMS_ARG] = {"most_common_elems", TEXTOID},
76 [MOST_COMMON_ELEM_FREQS_ARG] = {"most_common_elem_freqs", FLOAT4ARRAYOID},
77 [ELEM_COUNT_HISTOGRAM_ARG] = {"elem_count_histogram", FLOAT4ARRAYOID},
78 [RANGE_LENGTH_HISTOGRAM_ARG] = {"range_length_histogram", TEXTOID},
79 [RANGE_EMPTY_FRAC_ARG] = {"range_empty_frac", FLOAT4OID},
80 [RANGE_BOUNDS_HISTOGRAM_ARG] = {"range_bounds_histogram", TEXTOID},
82};

Referenced by attribute_statistics_update(), and pg_restore_attribute_stats().

◆ cleararginfo

struct StatsArgInfo cleararginfo[]
static
Initial value:
=
{
[C_ATTRELSCHEMA_ARG] = {"relation", TEXTOID},
[C_ATTRELNAME_ARG] = {"relation", TEXTOID},
[C_ATTNAME_ARG] = {"attname", TEXTOID},
[C_INHERITED_ARG] = {"inherited", BOOLOID},
}

Definition at line 98 of file attribute_stats.c.

99{
100 [C_ATTRELSCHEMA_ARG] = {"relation", TEXTOID},
101 [C_ATTRELNAME_ARG] = {"relation", TEXTOID},
102 [C_ATTNAME_ARG] = {"attname", TEXTOID},
103 [C_INHERITED_ARG] = {"inherited", BOOLOID},
105};

Referenced by pg_clear_attribute_stats().