

# pgactive functions reference
<a name="pgactive-functions-reference"></a>

Following, you can find a list of pgactive functions with their parameters, return values, and practical usage notes to help you effectively use them:

## get\$1last\$1applied\$1xact\$1info
<a name="get-last-applied-xact-info"></a>

Retrieves the last applied transaction information for a specified node.

**Arguments**  
+ sysid (text) - timeline OID
+ dboid (OID)

**Return type**  
It records the following:  
+ last\$1applied\$1xact\$1id (OID)
+ last\$1applied\$1xact\$1committs (timestamp with time zone)
+ last\$1applied\$1xact\$1at (timestamp with time zone)

**Usage notes**  
Use this function to retrieve the last applied transaction information for a specified node.

## pgactive\$1apply\$1pause
<a name="pgactive-apply-pause"></a>

Pauses the replication apply process.

**Arguments**  
None

**Return type**  
boolean

**Usage notes**  
Call this function to pause the replication apply process.

## pgactive\$1apply\$1resume
<a name="pgactive-apply-resume"></a>

Resumes the replication apply process.

**Arguments**  
None

**Return type**  
void

**Usage notes**  
Call this function to resume the replication apply process.

## pgactive\$1is\$1apply\$1paused
<a name="pgactive-is-apply-paused"></a>

Checks if replication apply is currently paused.

**Arguments**  
None

**Return type**  
boolean

**Usage notes**  
Use this function to check if replication apply is currently paused.

## pgactive\$1create\$1group
<a name="pgactive-create-group"></a>

Creates a pgactive group by converting a standalone database into the initial node.



**Arguments**  
+ node\$1name (text)
+ node\$1dsn (text)
+ apply\$1delay integer DEFAULT NULL::integer - replication\$1sets text[] DEFAULT ARRAY[‘default’::text]

**Return type**  
void

**Usage notes**  
Creates a pgactive group by converting a standalone database into the initial node. The function performs sanity checks before transforming the node into a pgactive node. Before using this function, ensure that your PostgreSQL cluster has sufficient `max_worker_processes` available to support pgactive background workers.

## pgactive\$1detach\$1nodes
<a name="pgactive-detach-nodes"></a>

Removes specified nodes from the pgactive group.

**Arguments**  
+ p\$1nodes (text[])

**Return type**  
void

**Usage notes**  
Use this function to remove specified nodes from the pgactive group.

## pgactive\$1exclude\$1table\$1replication\$1set
<a name="pgactive-exclude-table-replication-set"></a>

Excludes a specific table from replication.

**Arguments**  
+ p\$1relation (regclass)

**Return type**  
void

**Usage notes**  
Use this function to exclude a specific table from replication.

## pgactive\$1get\$1replication\$1lag\$1info
<a name="pgactive-get-replication-lag-info"></a>

Retrieves detailed replication lag information, including node details, WAL status, and LSN values.

**Arguments**  
None

**Return type**  
SETOF record - node\$1name text - node\$1sysid text - application\$1name text - slot\$1name text - active boolean - active\$1pid integer - pending\$1wal\$1decoding bigint - Approximate size of WAL in bytes to be decoded on the sender node - pending\$1wal\$1to\$1apply bigint - Approximate size of WAL in bytes to be applied on receiving node - restart\$1lsn pg\$1lsn - confirmed\$1flush\$1lsn pg\$1lsn - sent\$1lsn pg\$1lsn - write\$1lsn pg\$1lsn - flush\$1lsn pg\$1lsn - replay\$1lsn pg\$1lsn

**Usage notes**  
Call this function to retrieve replication lag information, including node details, WAL status, and LSN values.

## pgactive\$1get\$1stats
<a name="pgactive-get-stats"></a>

Retrieves pgactive replication statistics.

**Arguments**  
None

**Return type**  
SETOF record - rep\$1node\$1id oid - rilocalid oid - riremoteid text - nr\$1commit bigint - nr\$1rollback bigint - nr\$1insert bigint - nr\$1insert\$1conflict bigint - nr\$1update bigint - nr\$1update\$1conflict bigint - nr\$1delete bigint - nr\$1delete\$1conflict bigint - nr\$1disconnect bigint

**Usage notes**  
Use this function to retrieve pgactive replication statistics.

## pgactive\$1get\$1table\$1replication\$1sets
<a name="pgactive-get-table-replication-sets"></a>

Gets replication set configuration for a specific relation.

**Arguments**  
+ relation (regclass)

**Return type**  
SETOF record

**Usage notes**  
Call this function to get replication set configuration for a specific relation.

## pgactive\$1include\$1table\$1replication\$1set
<a name="pgactive-include-table-replication-set"></a>

Includes a specific table in replication.

**Arguments**  
+ p\$1relation (regclass)

**Return type**  
void

**Usage notes**  
Use this function to include a specific table in replication.

## pgactive\$1join\$1group
<a name="pgactive-join-group"></a>

Adds a node to an existing pgactive group.

**Arguments**  
+ node\$1name (text)
+ node\$1dsn (text)
+ join\$1using\$1dsn (text)
+ apply\$1delay (integer, optional)
+ replication\$1sets (text[], default: ['default'])
+ bypass\$1collation\$1check (boolean, default: false)
+ bypass\$1node\$1identifier\$1creation (boolean, default: false)
+ bypass\$1user\$1tables\$1check (boolean, default: false)

**Return type**  
void

**Usage notes**  
Call this function to add a node to an existing pgactive group. Ensure your PostgreSQL cluster has sufficient max\$1worker\$1processes for pgactive background workers.

## pgactive\$1remove
<a name="pgactive-remove"></a>

Removes all pgactive components from the local node.

**Arguments**  
+ force (boolean, default: false)

**Return type**  
void

**Usage notes**  
Call this function to remove all pgactive components from the local node.

## pgactive\$1snowflake\$1id\$1nextval
<a name="pgactive-snowflake-id-nextval"></a>

Generates node-specific unique sequence values.

**Arguments**  
+ regclass

**Return type**  
bigint

**Usage notes**  
Use this function to generate node-specific unique sequence values.

## pgactive\$1update\$1node\$1conninfo
<a name="pgactive-update-node-conninfo"></a>

Updates connection information for a pgactive node.

**Arguments**  
+ node\$1name\$1to\$1update (text)
+ node\$1dsn\$1to\$1update (text)

**Return type**  
void

**Usage notes**  
Use this function to update connection information for a pgactive node.

## pgactive\$1wait\$1for\$1node\$1ready
<a name="pgactive-wait-for-node-ready"></a>

Monitors the progress of group creation or joining operations.

**Arguments**  
+ timeout (integer, default: 0)
+ progress\$1interval (integer, default: 60)

**Return type**  
void

**Usage notes**  
Call this function to monitor the progress of group creation or joining operations.