PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/detoast.h"
#include "commands/vacuum.h"
#include "utils/array.h"
#include "utils/datum.h"
#include "utils/fmgrprotos.h"
#include "utils/lsyscache.h"
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | ArrayAnalyzeExtraData |
struct | TrackItem |
struct | DECountItem |
Macros | |
#define | ARRAY_WIDTH_THRESHOLD 0x10000 |
Functions | |
static void | compute_array_stats (VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows) |
static void | prune_element_hashtable (HTAB *elements_tab, int b_current) |
static uint32 | element_hash (const void *key, Size keysize) |
static int | element_match (const void *key1, const void *key2, Size keysize) |
static int | element_compare (const void *key1, const void *key2) |
static int | trackitem_compare_frequencies_desc (const void *e1, const void *e2, void *arg) |
static int | trackitem_compare_element (const void *e1, const void *e2, void *arg) |
static int | countitem_compare_count (const void *e1, const void *e2, void *arg) |
Datum | array_typanalyze (PG_FUNCTION_ARGS) |
Variables | |
static ArrayAnalyzeExtraData * | array_extra_data |
#define ARRAY_WIDTH_THRESHOLD 0x10000 |
Definition at line 33 of file array_typanalyze.c.
Datum array_typanalyze | ( | PG_FUNCTION_ARGS | ) |
Definition at line 98 of file array_typanalyze.c.
References VacAttrStats::attrcollid, VacAttrStats::attrtypid, ArrayAnalyzeExtraData::cmp, TypeCacheEntry::cmp_proc_finfo, ArrayAnalyzeExtraData::coll_id, compute_array_stats(), VacAttrStats::compute_stats, elog, ArrayAnalyzeExtraData::eq_opr, TypeCacheEntry::eq_opr, ERROR, VacAttrStats::extra_data, FmgrInfo::fn_oid, get_base_element_type(), ArrayAnalyzeExtraData::hash, TypeCacheEntry::hash_proc_finfo, lookup_type_cache(), OidIsValid, palloc(), PG_GETARG_POINTER, PG_RETURN_BOOL, ArrayAnalyzeExtraData::std_compute_stats, ArrayAnalyzeExtraData::std_extra_data, std_typanalyze(), ArrayAnalyzeExtraData::typalign, TypeCacheEntry::typalign, ArrayAnalyzeExtraData::typbyval, TypeCacheEntry::typbyval, ArrayAnalyzeExtraData::type_id, TypeCacheEntry::type_id, TYPECACHE_CMP_PROC_FINFO, TYPECACHE_EQ_OPR, TYPECACHE_HASH_PROC_FINFO, ArrayAnalyzeExtraData::typlen, and TypeCacheEntry::typlen.
|
static |
Definition at line 216 of file array_typanalyze.c.
References VacAttrStats::anl_context, ARR_ELEMTYPE, array_extra_data, ARRAY_WIDTH_THRESHOLD, Assert, VacAttrStats::attstattarget, ArrayAnalyzeExtraData::coll_id, DECountItem::count, countitem_compare_count(), CurrentMemoryContext, datumCopy(), DatumGetArrayTypeP, DEBUG3, deconstruct_array(), TrackItem::delta, element_hash(), element_match(), elog, HASHCTL::entrysize, ArrayAnalyzeExtraData::eq_opr, ERROR, VacAttrStats::extra_data, TrackItem::frequency, DECountItem::frequency, HASHCTL::hash, HASH_BLOBS, HASH_COMPARE, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_ENTER, HASH_FUNCTION, hash_get_num_entries(), hash_search(), hash_seq_init(), hash_seq_search(), HASHCTL::hcxt, i, INT64_FORMAT, j, TrackItem::key, HASHCTL::keysize, TrackItem::last_container, HASHCTL::match, Max, MemoryContextAlloc(), MemoryContextSwitchTo(), Min, VacAttrStats::numnumbers, VacAttrStats::numvalues, palloc(), pfree(), PointerGetDatum(), prune_element_hashtable(), qsort_interruptible(), VacAttrStats::stacoll, VacAttrStats::stakind, VacAttrStats::stanumbers, VacAttrStats::staop, STATISTIC_NUM_SLOTS, VacAttrStats::statypalign, VacAttrStats::statypbyval, VacAttrStats::statypid, VacAttrStats::statyplen, VacAttrStats::stavalues, ArrayAnalyzeExtraData::std_compute_stats, ArrayAnalyzeExtraData::std_extra_data, toast_raw_datum_size(), trackitem_compare_element(), trackitem_compare_frequencies_desc(), ArrayAnalyzeExtraData::typalign, ArrayAnalyzeExtraData::typbyval, ArrayAnalyzeExtraData::type_id, ArrayAnalyzeExtraData::typlen, vacuum_delay_point(), and value.
Referenced by array_typanalyze().
|
static |
|
static |
Definition at line 740 of file array_typanalyze.c.
References array_extra_data, ArrayAnalyzeExtraData::cmp, ArrayAnalyzeExtraData::coll_id, DatumGetInt32(), and FunctionCall2Coll().
Referenced by element_match(), and trackitem_compare_element().
Definition at line 710 of file array_typanalyze.c.
References array_extra_data, ArrayAnalyzeExtraData::coll_id, DatumGetUInt32(), FunctionCall1Coll(), ArrayAnalyzeExtraData::hash, and sort-test::key.
Referenced by compute_array_stats(), hash_record(), and hash_record_extended().
|
static |
Definition at line 725 of file array_typanalyze.c.
References element_compare().
Referenced by compute_array_stats().
|
static |
Definition at line 681 of file array_typanalyze.c.
References array_extra_data, DatumGetPointer(), TrackItem::delta, elog, ERROR, TrackItem::frequency, HASH_REMOVE, hash_search(), hash_seq_init(), hash_seq_search(), TrackItem::key, pfree(), ArrayAnalyzeExtraData::typbyval, and value.
Referenced by compute_array_stats().
|
static |
Definition at line 768 of file array_typanalyze.c.
References element_compare().
Referenced by compute_array_stats().
|
static |
Definition at line 756 of file array_typanalyze.c.
References TrackItem::frequency.
Referenced by compute_array_stats().
|
static |
Definition at line 65 of file array_typanalyze.c.
Referenced by compute_array_stats(), element_compare(), element_hash(), and prune_element_hashtable().