Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87ae9e7

Browse files
committed
Remove some unused and seldom used fields from RelationAmInfo.
This saves some memory from each index relcache entry. At least on a 64-bitmachine, it saves just enough to shrink a typical relcache entry's memoryusage from 2k to 1k. That's nice if you have a lot of backends and a lot ofindexes.
1 parentc74d586 commit87ae9e7

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

‎src/backend/access/index/indexam.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ do { \
114114
} \
115115
} while(0)
116116

117+
#defineGET_UNCACHED_REL_PROCEDURE(pname) \
118+
do { \
119+
if (!RegProcedureIsValid(indexRelation->rd_am->pname)) \
120+
elog(ERROR, "invalid %s regproc", CppAsString(pname)); \
121+
fmgr_info(indexRelation->rd_am->pname, &procedure); \
122+
} while(0)
123+
117124
#defineGET_SCAN_PROCEDURE(pname) \
118125
do { \
119126
procedure = &scan->indexRelation->rd_aminfo->pname; \
@@ -671,14 +678,14 @@ index_bulk_delete(IndexVacuumInfo *info,
671678
void*callback_state)
672679
{
673680
RelationindexRelation=info->index;
674-
FmgrInfo*procedure;
681+
FmgrInfoprocedure;
675682
IndexBulkDeleteResult*result;
676683

677684
RELATION_CHECKS;
678-
GET_REL_PROCEDURE(ambulkdelete);
685+
GET_UNCACHED_REL_PROCEDURE(ambulkdelete);
679686

680687
result= (IndexBulkDeleteResult*)
681-
DatumGetPointer(FunctionCall4(procedure,
688+
DatumGetPointer(FunctionCall4(&procedure,
682689
PointerGetDatum(info),
683690
PointerGetDatum(stats),
684691
PointerGetDatum((Pointer)callback),
@@ -698,14 +705,14 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
698705
IndexBulkDeleteResult*stats)
699706
{
700707
RelationindexRelation=info->index;
701-
FmgrInfo*procedure;
708+
FmgrInfoprocedure;
702709
IndexBulkDeleteResult*result;
703710

704711
RELATION_CHECKS;
705-
GET_REL_PROCEDURE(amvacuumcleanup);
712+
GET_UNCACHED_REL_PROCEDURE(amvacuumcleanup);
706713

707714
result= (IndexBulkDeleteResult*)
708-
DatumGetPointer(FunctionCall2(procedure,
715+
DatumGetPointer(FunctionCall2(&procedure,
709716
PointerGetDatum(info),
710717
PointerGetDatum(stats)));
711718

‎src/include/utils/rel.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ typedef LockInfoData *LockInfo;
4747

4848

4949
/*
50-
* Cached lookup information for the index access method functions defined
51-
* by the pg_am row associated with an index relation.
50+
* Cached lookup information for thefrequently usedindex access method
51+
*functions, definedby the pg_am row associated with an index relation.
5252
*/
5353
typedefstructRelationAmInfo
5454
{
@@ -60,13 +60,7 @@ typedef struct RelationAmInfo
6060
FmgrInfoamendscan;
6161
FmgrInfoammarkpos;
6262
FmgrInfoamrestrpos;
63-
FmgrInfoambuild;
64-
FmgrInfoambuildempty;
65-
FmgrInfoambulkdelete;
66-
FmgrInfoamvacuumcleanup;
6763
FmgrInfoamcanreturn;
68-
FmgrInfoamcostestimate;
69-
FmgrInfoamoptions;
7064
}RelationAmInfo;
7165

7266

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp