Remove some unused and seldom used fields from RelationAmInfo.
This saves some memory from each index relcache entry. At least on a 64-bit machine, it saves just enough to shrink a typical relcache entry's memory usage from 2k to 1k. That's nice if you have a lot of backends and a lot of indexes.
This commit is contained in:
parent
c74d586d2f
commit
87ae9e7265
|
@ -114,6 +114,13 @@ do { \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#define GET_UNCACHED_REL_PROCEDURE(pname) \
|
||||||
|
do { \
|
||||||
|
if (!RegProcedureIsValid(indexRelation->rd_am->pname)) \
|
||||||
|
elog(ERROR, "invalid %s regproc", CppAsString(pname)); \
|
||||||
|
fmgr_info(indexRelation->rd_am->pname, &procedure); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define GET_SCAN_PROCEDURE(pname) \
|
#define GET_SCAN_PROCEDURE(pname) \
|
||||||
do { \
|
do { \
|
||||||
procedure = &scan->indexRelation->rd_aminfo->pname; \
|
procedure = &scan->indexRelation->rd_aminfo->pname; \
|
||||||
|
@ -671,14 +678,14 @@ index_bulk_delete(IndexVacuumInfo *info,
|
||||||
void *callback_state)
|
void *callback_state)
|
||||||
{
|
{
|
||||||
Relation indexRelation = info->index;
|
Relation indexRelation = info->index;
|
||||||
FmgrInfo *procedure;
|
FmgrInfo procedure;
|
||||||
IndexBulkDeleteResult *result;
|
IndexBulkDeleteResult *result;
|
||||||
|
|
||||||
RELATION_CHECKS;
|
RELATION_CHECKS;
|
||||||
GET_REL_PROCEDURE(ambulkdelete);
|
GET_UNCACHED_REL_PROCEDURE(ambulkdelete);
|
||||||
|
|
||||||
result = (IndexBulkDeleteResult *)
|
result = (IndexBulkDeleteResult *)
|
||||||
DatumGetPointer(FunctionCall4(procedure,
|
DatumGetPointer(FunctionCall4(&procedure,
|
||||||
PointerGetDatum(info),
|
PointerGetDatum(info),
|
||||||
PointerGetDatum(stats),
|
PointerGetDatum(stats),
|
||||||
PointerGetDatum((Pointer) callback),
|
PointerGetDatum((Pointer) callback),
|
||||||
|
@ -698,14 +705,14 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
|
||||||
IndexBulkDeleteResult *stats)
|
IndexBulkDeleteResult *stats)
|
||||||
{
|
{
|
||||||
Relation indexRelation = info->index;
|
Relation indexRelation = info->index;
|
||||||
FmgrInfo *procedure;
|
FmgrInfo procedure;
|
||||||
IndexBulkDeleteResult *result;
|
IndexBulkDeleteResult *result;
|
||||||
|
|
||||||
RELATION_CHECKS;
|
RELATION_CHECKS;
|
||||||
GET_REL_PROCEDURE(amvacuumcleanup);
|
GET_UNCACHED_REL_PROCEDURE(amvacuumcleanup);
|
||||||
|
|
||||||
result = (IndexBulkDeleteResult *)
|
result = (IndexBulkDeleteResult *)
|
||||||
DatumGetPointer(FunctionCall2(procedure,
|
DatumGetPointer(FunctionCall2(&procedure,
|
||||||
PointerGetDatum(info),
|
PointerGetDatum(info),
|
||||||
PointerGetDatum(stats)));
|
PointerGetDatum(stats)));
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ typedef LockInfoData *LockInfo;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cached lookup information for the index access method functions defined
|
* Cached lookup information for the frequently used index access method
|
||||||
* by the pg_am row associated with an index relation.
|
* functions, defined by the pg_am row associated with an index relation.
|
||||||
*/
|
*/
|
||||||
typedef struct RelationAmInfo
|
typedef struct RelationAmInfo
|
||||||
{
|
{
|
||||||
|
@ -60,13 +60,7 @@ typedef struct RelationAmInfo
|
||||||
FmgrInfo amendscan;
|
FmgrInfo amendscan;
|
||||||
FmgrInfo ammarkpos;
|
FmgrInfo ammarkpos;
|
||||||
FmgrInfo amrestrpos;
|
FmgrInfo amrestrpos;
|
||||||
FmgrInfo ambuild;
|
|
||||||
FmgrInfo ambuildempty;
|
|
||||||
FmgrInfo ambulkdelete;
|
|
||||||
FmgrInfo amvacuumcleanup;
|
|
||||||
FmgrInfo amcanreturn;
|
FmgrInfo amcanreturn;
|
||||||
FmgrInfo amcostestimate;
|
|
||||||
FmgrInfo amoptions;
|
|
||||||
} RelationAmInfo;
|
} RelationAmInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue