Documentation / Extension Hooks / Statistics and estimation
get_attavgwidth_hook
get_attavgwidth_hook
Hook for plugins to get control in get_attavgwidth()
Reading PostgreSQL 18.
Description
Hook for plugins to get control in get_attavgwidth()
- Interface type
- get_attavgwidth_hook_type
- Header
- src/include/utils/lsyscache.h
- Subsystem
- Statistics and estimation
- Initial value
- NULL (no hook installed)
C interface
typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum);
extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook;Call sites
src/backend/utils/cache/lsyscache.c:3467
Core call context: src/backend/utils/cache/lsyscache.c:3461–3475
{
HeapTuple tp;
int32 stawidth;
if (get_attavgwidth_hook)
{
stawidth = (*get_attavgwidth_hook) (relid, attnum);
if (stawidth > 0)
return stawidth;
}
tp = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(attnum),
BoolGetDatum(false));
if (HeapTupleIsValid(tp))Related entries
Documentation and source
Source build
- Version
- 18
- Build
- REL_18_STABLE
- Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd
Related entries
get_index_stats_hookget_index_stats_hookget_relation_stats_hookget_relation_stats_hook
Back to Extension Hooks · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.