PostgreSQL Source Code git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/relation.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "port/pg_numa.h"
#include "storage/buf_internals.h"
#include "storage/bufmgr.h"
#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
struct | BufferCachePagesRec |
struct | BufferCachePagesContext |
struct | BufferCacheNumaRec |
struct | BufferCacheNumaContext |
Macros | |
#define | NUM_BUFFERCACHE_PAGES_MIN_ELEM 8 |
#define | NUM_BUFFERCACHE_PAGES_ELEM 9 |
#define | NUM_BUFFERCACHE_SUMMARY_ELEM 5 |
#define | NUM_BUFFERCACHE_USAGE_COUNTS_ELEM 4 |
#define | NUM_BUFFERCACHE_EVICT_ELEM 2 |
#define | NUM_BUFFERCACHE_EVICT_RELATION_ELEM 3 |
#define | NUM_BUFFERCACHE_EVICT_ALL_ELEM 3 |
#define | NUM_BUFFERCACHE_NUMA_ELEM 3 |
Variables | |
static bool | firstNumaTouch = true |
#define NUM_BUFFERCACHE_EVICT_ALL_ELEM 3 |
Definition at line 27 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_EVICT_ELEM 2 |
Definition at line 25 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_EVICT_RELATION_ELEM 3 |
Definition at line 26 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_NUMA_ELEM 3 |
Definition at line 29 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_PAGES_ELEM 9 |
Definition at line 22 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_PAGES_MIN_ELEM 8 |
Definition at line 21 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_SUMMARY_ELEM 5 |
Definition at line 23 of file pg_buffercache_pages.c.
#define NUM_BUFFERCACHE_USAGE_COUNTS_ELEM 4 |
Definition at line 24 of file pg_buffercache_pages.c.
Datum pg_buffercache_evict | ( | PG_FUNCTION_ARGS | ) |
Definition at line 664 of file pg_buffercache_pages.c.
References BoolGetDatum(), buf, elog, ERROR, EvictUnpinnedBuffer(), get_call_result_type(), heap_form_tuple(), HeapTupleGetDatum(), NBuffers, NUM_BUFFERCACHE_EVICT_ELEM, pg_buffercache_superuser_check(), PG_GETARG_INT32, PG_RETURN_DATUM, TYPEFUNC_COMPOSITE, and values.
Datum pg_buffercache_evict_all | ( | PG_FUNCTION_ARGS | ) |
Definition at line 746 of file pg_buffercache_pages.c.
References elog, ERROR, EvictAllUnpinnedBuffers(), get_call_result_type(), heap_form_tuple(), HeapTupleGetDatum(), Int32GetDatum(), NUM_BUFFERCACHE_EVICT_ALL_ELEM, pg_buffercache_superuser_check(), PG_RETURN_DATUM, TYPEFUNC_COMPOSITE, and values.
Datum pg_buffercache_evict_relation | ( | PG_FUNCTION_ARGS | ) |
Definition at line 696 of file pg_buffercache_pages.c.
References AccessShareLock, elog, ereport, errcode(), errmsg(), ERROR, EvictRelUnpinnedBuffers(), get_call_result_type(), heap_form_tuple(), HeapTupleGetDatum(), Int32GetDatum(), NUM_BUFFERCACHE_EVICT_RELATION_ELEM, pg_buffercache_superuser_check(), PG_GETARG_OID, PG_RETURN_DATUM, relation_close(), relation_open(), RelationUsesLocalBuffers, TYPEFUNC_COMPOSITE, and values.
Datum pg_buffercache_numa_pages | ( | PG_FUNCTION_ARGS | ) |
Definition at line 303 of file pg_buffercache_pages.c.
References Assert(), BlessTupleDesc(), BufferDescriptorGetBuffer(), BufferGetBlock(), BufferCacheNumaRec::bufferid, FuncCallContext::call_cntr, CHECK_FOR_INTERRUPTS, CreateTemplateTupleDesc(), CurrentMemoryContext, DEBUG1, elog, ERROR, firstNumaTouch, get_call_result_type(), GetBufferDescriptor(), heap_form_tuple(), HeapTupleGetDatum(), i, idx(), Int32GetDatum(), Int64GetDatum(), LockBufHdr(), Max, FuncCallContext::max_calls, MemoryContextAllocHuge(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, TupleDescData::natts, NBuffers, NUM_BUFFERCACHE_NUMA_ELEM, BufferCacheNumaRec::numa_node, BufferCacheNumaRec::page_num, palloc(), palloc0(), pg_attribute_unused, pg_get_shmem_pagesize(), pg_numa_init(), pg_numa_query_pages(), pg_numa_touch_mem_if_required, BufferCacheNumaContext::record, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, BufferCacheNumaContext::tupdesc, TupleDescInitEntry(), TYPEALIGN, TYPEALIGN_DOWN, TYPEFUNC_COMPOSITE, UINT64_FORMAT, UnlockBufHdr(), FuncCallContext::user_fctx, and values.
Datum pg_buffercache_pages | ( | PG_FUNCTION_ARGS | ) |
Definition at line 110 of file pg_buffercache_pages.c.
References BlessTupleDesc(), BufferCachePagesRec::blocknum, buftag::blockNum, BM_DIRTY, BM_TAG_VALID, BM_VALID, BoolGetDatum(), BUF_STATE_GET_REFCOUNT, BUF_STATE_GET_USAGECOUNT, BufferDescriptorGetBuffer(), BufferCachePagesRec::bufferid, BufTagGetForkNum(), BufTagGetRelNumber(), FuncCallContext::call_cntr, CreateTemplateTupleDesc(), CurrentMemoryContext, buftag::dbOid, elog, ERROR, BufferCachePagesRec::forknum, get_call_result_type(), GetBufferDescriptor(), heap_form_tuple(), HeapTupleGetDatum(), i, Int16GetDatum(), Int32GetDatum(), Int64GetDatum(), InvalidBlockNumber, BufferCachePagesRec::isdirty, BufferCachePagesRec::isvalid, LockBufHdr(), FuncCallContext::max_calls, MemoryContextAllocHuge(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, TupleDescData::natts, NBuffers, NUM_BUFFERCACHE_PAGES_ELEM, NUM_BUFFERCACHE_PAGES_MIN_ELEM, ObjectIdGetDatum(), palloc(), BufferCachePagesRec::pinning_backends, BufferCachePagesContext::record, BufferCachePagesRec::reldatabase, BufferCachePagesRec::relfilenumber, BufferCachePagesRec::reltablespace, buftag::spcOid, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, BufferDesc::tag, BufferCachePagesContext::tupdesc, TupleDescInitEntry(), TYPEFUNC_COMPOSITE, UnlockBufHdr(), BufferCachePagesRec::usagecount, FuncCallContext::user_fctx, and values.
Datum pg_buffercache_summary | ( | PG_FUNCTION_ARGS | ) |
Definition at line 542 of file pg_buffercache_pages.c.
References BM_DIRTY, BM_VALID, BUF_STATE_GET_REFCOUNT, BUF_STATE_GET_USAGECOUNT, elog, ERROR, Float8GetDatum(), get_call_result_type(), GetBufferDescriptor(), heap_form_tuple(), HeapTupleGetDatum(), i, Int32GetDatum(), NBuffers, NUM_BUFFERCACHE_SUMMARY_ELEM, pg_atomic_read_u32(), PG_RETURN_DATUM, BufferDesc::state, TYPEFUNC_COMPOSITE, and values.
|
static |
Definition at line 651 of file pg_buffercache_pages.c.
References ereport, errcode(), errmsg(), ERROR, and superuser().
Referenced by pg_buffercache_evict(), pg_buffercache_evict_all(), and pg_buffercache_evict_relation().
Datum pg_buffercache_usage_counts | ( | PG_FUNCTION_ARGS | ) |
Definition at line 607 of file pg_buffercache_pages.c.
References BM_MAX_USAGE_COUNT.
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_evict | ) |
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_evict_all | ) |
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_evict_relation | ) |
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_numa_pages | ) |
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_pages | ) |
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_summary | ) |
PG_FUNCTION_INFO_V1 | ( | pg_buffercache_usage_counts | ) |
PG_MODULE_MAGIC_EXT | ( | . | name = "pg_buffercache" , |
. | version = PG_VERSION |
||
) |
|
static |
Definition at line 106 of file pg_buffercache_pages.c.
Referenced by pg_buffercache_numa_pages().