PostgreSQL Source Code  git master
freespace.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * freespace.h
4  * POSTGRES free space map for quickly finding free space in relations
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/storage/freespace.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef FREESPACE_H_
15 #define FREESPACE_H_
16 
17 #include "storage/block.h"
18 #include "storage/relfilenode.h"
19 #include "utils/relcache.h"
20 
21 /* prototypes for public functions in freespace.c */
22 extern Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk);
23 extern BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded);
25  BlockNumber oldPage,
26  Size oldSpaceAvail,
27  Size spaceNeeded);
28 extern void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk,
29  Size spaceAvail);
30 extern void XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
31  Size spaceAvail);
32 
33 extern void FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks);
34 extern void FreeSpaceMapVacuum(Relation rel);
35 extern void UpdateFreeSpaceMap(Relation rel,
36  BlockNumber startBlkNum,
37  BlockNumber endBlkNum,
38  Size freespace);
39 
40 #endif /* FREESPACE_H_ */
BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded)
Definition: freespace.c:132
uint32 BlockNumber
Definition: block.h:31
BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, BlockNumber oldPage, Size oldSpaceAvail, Size spaceNeeded)
Definition: freespace.c:149
void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, Size spaceAvail)
Definition: freespace.c:181
void FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
Definition: freespace.c:299
void XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk, Size spaceAvail)
Definition: freespace.c:238
Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk)
Definition: freespace.c:270
void UpdateFreeSpaceMap(Relation rel, BlockNumber startBlkNum, BlockNumber endBlkNum, Size freespace)
Definition: freespace.c:201
size_t Size
Definition: c.h:404
void FreeSpaceMapVacuum(Relation rel)
Definition: freespace.c:379