

# Understanding the pgactive schema
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.schema"></a>

The pgactive schema manages active-active replication in RDS for PostgreSQL. This schema contains tables that store replication configuration and status information.

**Note**  
The pgactive schema is evolving and subject to change. Don't modify the data in these tables directly.

The key tables in the pgactive schema include:
+ `pgactive_nodes` – Stores information about nodes in the active-active replication group.
+ `pgactive_connections` – Stores connection details for each node.

## pgactive\$1nodes
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.schema.nodes"></a>

The pgactive\$1nodes stores information about the nodes participating in the active-active replication group. 


| Column | Type | Collation | Nullable | Default | 
| --- | --- | --- | --- | --- | 
| node\$1sysid | text | – | not null | – | 
| node\$1timeline | oid | – | not null | – | 
| node\$1dboid | oid | – | not null | – | 
| node\$1status | char | – | not null | – | 
| node\$1name | text | – | not null | – | 
| node\$1dsn | text | – | not null | – | 
| node\$1init\$1from\$1dsn | text | – | not null | – | 
| node\$1read\$1only | boolean | – | – | false | 
| node\$1seq\$1id | smallint | – | not null | – | 

**node\$1sysid**  
Unique ID for a node, generated during `pgactive_create_group` or `pgactive_join_group`

**node\$1status**  
Readiness of the node:  
+ **b** - beginning setup
+ **i** - initializing
+ **c** - catchup
+ **o** - creating outbound slots
+ **r** - ready
+ **k** - killed
This column doesn't indicate if a node is connected or disconnected.

**node\$1name**  
User-provided unique node name.

**node\$1dsn**  
Connection string or user mapping name

**node\$1init\$1from\$1dsn**  
DSN from which this node was created.

## pgactive\$1connection
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.schema.connection"></a>

The pgactive\$1connections stores connection details for each node.


| Column | Type | Collation | Nullable | Default | 
| --- | --- | --- | --- | --- | 
| conn\$1sysid | text | none | not null | none | 
| conn\$1timeline | oid | none | not null | none | 
| conn\$1dboid | oid | none | not null | none | 
| conn\$1dsn | text | none | not null | none | 
| conn\$1apply\$1delay | integer | none | none | none | 
| conn\$1replication\$1sets | text | none | none | none | 

conn\$1sysid  
Node identifier for the node this entry refers to.

conn\$1dsn  
Same as pgactive.pgactive\$1nodes `node_dsn`.

conn\$1apply\$1delay  
If set, milliseconds to wait before applying each transaction from the remote node. Mainly for debugging. If null, the global default applies.

## Working with replication sets
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.replication"></a>

Replication sets determine which tables to include or exclude from replication operations. By default, all tables are replicated unless you specify otherwise using the following functions:
+ `pgactive_exclude_table_replication_set()` - Excludes specified tables from replication
+ `pgactive_include_table_replication_set()` - Includes specified tables in replication

**Note**  
Before you configure replication sets, consider the following:  
You can configure table inclusion or exclusion only after running `pgactive_create_group()` but before `pgactive_join_group()`.
After you use `pgactive_exclude_table_replication_set()`, you can't use `pgactive_include_table_replication_set()`.
After you use `pgactive_include_table_replication_set()`, you can't use `pgactive_exclude_table_replication_set()`.

The system handles newly created tables differently based on your initial configuration:
+ If you excluded tables: Any new tables created after `pgactive_join_group()` are automatically included in replication
+ If you included tables: Any new tables created after `pgactive_join_group()` are automatically excluded from replication.

To view the replication set configuration for a specific table, use the `pgactive.pgactive_get_table_replication_sets()` function.