18 #define NUM_BUFFERCACHE_PAGES_MIN_ELEM 8
19 #define NUM_BUFFERCACHE_PAGES_ELEM 9
20 #define NUM_BUFFERCACHE_SUMMARY_ELEM 5
21 #define NUM_BUFFERCACHE_USAGE_COUNTS_ELEM 4
100 elog(
ERROR,
"return type must be a row type");
104 elog(
ERROR,
"incorrect number of output arguments");
255 int32 buffers_used = 0;
256 int32 buffers_unused = 0;
257 int32 buffers_dirty = 0;
258 int32 buffers_pinned = 0;
259 int64 usagecount_total = 0;
262 elog(
ERROR,
"return type must be a row type");
293 memset(nulls, 0,
sizeof(nulls));
299 if (buffers_used != 0)
330 usage_counts[usage_count]++;
333 dirty[usage_count]++;
336 pinned[usage_count]++;
362 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
363 errmsg(
"must be superuser to use pg_buffercache_evict function")));
static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
#define InvalidBlockNumber
static Datum values[MAXATTR]
#define BM_MAX_USAGE_COUNT
static ForkNumber BufTagGetForkNum(const BufferTag *tag)
static BufferDesc * GetBufferDescriptor(uint32 id)
static void UnlockBufHdr(BufferDesc *desc, uint32 buf_state)
static RelFileNumber BufTagGetRelNumber(const BufferTag *tag)
#define BUF_STATE_GET_USAGECOUNT(state)
#define BUF_STATE_GET_REFCOUNT(state)
static Buffer BufferDescriptorGetBuffer(const BufferDesc *bdesc)
bool EvictUnpinnedBuffer(Buffer buf)
uint32 LockBufHdr(BufferDesc *desc)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Datum Int64GetDatum(int64 X)
Datum Float8GetDatum(float8 X)
#define PG_GETARG_INT32(n)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_BOOL(x)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
MemoryContext CurrentMemoryContext
void * MemoryContextAllocHuge(MemoryContext context, Size size)
#define NUM_BUFFERCACHE_USAGE_COUNTS_ELEM
Datum pg_buffercache_evict(PG_FUNCTION_ARGS)
Datum pg_buffercache_summary(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(pg_buffercache_pages)
Datum pg_buffercache_usage_counts(PG_FUNCTION_ARGS)
#define NUM_BUFFERCACHE_SUMMARY_ELEM
Datum pg_buffercache_pages(PG_FUNCTION_ARGS)
#define NUM_BUFFERCACHE_PAGES_MIN_ELEM
#define NUM_BUFFERCACHE_PAGES_ELEM
static Datum Int16GetDatum(int16 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum Int32GetDatum(int32 X)
MemoryContextSwitchTo(old_ctx)
BufferCachePagesRec * record
RelFileNumber relfilenumber
MemoryContext multi_call_memory_ctx
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)