mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Speedup truncations of relation forks.
When a relation is truncated, shared_buffers needs to be scanned so that any buffers for the relation forks are invalidated in it. Previously, shared_buffers was scanned for each relation forks, i.e., MAIN, FSM and VM, when VACUUM truncated off any empty pages at the end of relation or TRUNCATE truncated the relation in place. Since shared_buffers needed to be scanned multiple times, it could take a long time to finish those commands especially when shared_buffers was large. This commit changes the logic so that shared_buffers is scanned only one time for those three relation forks. Author: Kirk Jamison Reviewed-by: Masahiko Sawada, Thomas Munro, Alvaro Herrera, Takayuki Tsunakawa and Fujii Masao Discussion: https://postgr.es/m/D09B13F772D2274BB348A310EE3027C64E2067@g01jpexmbkw24
This commit is contained in:
@@ -101,8 +101,8 @@ extern void smgrwrite(SMgrRelation reln, ForkNumber forknum,
|
||||
extern void smgrwriteback(SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber blocknum, BlockNumber nblocks);
|
||||
extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum);
|
||||
extern void smgrtruncate(SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber nblocks);
|
||||
extern void smgrtruncate(SMgrRelation reln, ForkNumber *forknum,
|
||||
int nforks, BlockNumber *nblocks);
|
||||
extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum);
|
||||
extern void AtEOXact_SMgr(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user