System functions v6.0.0
Perform PGD management primarily by using functions you call from SQL.
All functions in PGD are exposed in the bdr
schema. Schema qualify any calls to these
functions instead of putting bdr
in the
search_path
.
Version information functions
bdr.bdr_version
This function retrieves the textual representation of the version of the BDR extension currently in use.
bdr.bdr_version_num
This function retrieves the version number of the BDR extension that is currently in use. Version numbers are monotonically increasing, allowing this value to be used for less-than and greater-than comparisons.
The following formula returns the version number consisting of major version, minor version, and patch release into a single numerical value:
MAJOR_VERSION * 10000 + MINOR_VERSION * 100 + PATCH_RELEASE
System information functions
bdr.get_relation_stats
Returns the relation information.
bdr.get_subscription_stats
Returns the current subscription statistics.
System and progress information parameters
PGD exposes some parameters that you can query directly in SQL using, for example,
SHOW
or the current_setting()
function. You can also use PQparameterStatus
(or equivalent) from a client application.
bdr.local_node_id
When you initialize a session, this is set to the node id the client is connected to. This allows an application to figure out the node it's connected to, even behind a transparent proxy.
It's also used with Connection pools and proxies.
bdr.last_committed_lsn
After every COMMIT
of an asynchronous transaction, this parameter is updated to
point to the end of the commit record on the origin node. Combining it with bdr.wait_for_apply_queue
,
allows applications
to perform causal reads across multiple nodes, that is, to wait until a transaction
becomes remotely visible.
transaction_id
If a CAMO transaction is in progress, transaction_id
is updated to show
the assigned transaction id. You can query this parameter only by using
using PQparameterStatus
or equivalent. See Application use
for a usage example.