Segment-Page Storage Functions
local_segment_space_info(tablespacename TEXT, databasename TEXT)
Description: This API has been discarded and is unavailable currently.
pg_stat_segment_extent_usage(int4 tablespace oid, int4 database oid, int4 extent_type, int4 forknum)
Description: This API has been discarded and is unavailable currently.
local_space_shrink(tablespacename TEXT, databasename TEXT)
Description: Shrinks specified physical segment-page space on the current node. Only the currently connected database can be shrank.
Return value: empty
gs_space_shrink(int4 tablespace, int4 database, int4 extent_type, int4 forknum)
Description: Works similar to local_space_shrink, that is, shrinks specified physical segment-page space. However, the parameters are different. The input parameters are the OIDs of the tablespace and database, and the value of extent_type is an integer ranging from 2 to 5. Note: The value 1 of extent_type indicates segment-page metadata. Currently, the physical file that contains the metadata cannot be shrunk. This function is used only by tools. You are not advised to use it directly.
Return value: empty
pg_stat_remain_segment_info()
Description: Displays residual extents on the current node due to faults. Residual extents are classified into two types: segments that are allocated but not used and extents that are allocated but not used. The main difference is that a segment contains multiple extents. During reclamation, all extents in the segment need to be recycled.
Return type:
Extent type. The options are as follows: ALLOC_SEGMENT, DROP_SEGMENT, and SHRINK_EXTENT.
The values of type are described as follows:
ALLOC_SEGMENT: When a user creates a segment-page table and the segment is just allocated but the transaction of creating a table is not committed, the node is faulty. As a result, the segment is not used after being allocated.
DROP_SEGMENT: When a user deletes a segment-page table and the transaction is successfully committed, the bit corresponding to the segment page of the table is not reset and a fault, such as power failure, occurs. As a result, the segment is not used or released.
SHRINK_EXTENT: When a user shrinks a segment-page table and does not release the idle extent, a fault, such as power failure, occurs. As a result, the extent remains and cannot be reused.
Example:
select * from pg_stat_remain_segment_info(); space_id | db_id | block_id | type ----------+-------+----------+------ 1663 | 16385| 4156| ALLOC_SEGMENT
pg_free_remain_segment(int4 spaceId, int4 dbId, int4 segmentId)
Description: Releases a specified residual extent. The value must be obtained from the pg_stat_remain_segment_info function. The function verifies input values. If the specified extent is not among the recorded residual extents, an error message is returned. If the specified extent is a single extent, the extent is released independently. If it is a segment, the segment and all extents in the segment are released.
Return value: empty