yb_server_zone()

Synopsis

yb_server_zone() returns the zone that a user's server is connected to.

Examples

Select the zone that you're connected to:

yugabyte=# SELECT yb_server_zone();
 yb_server_zone
-----------------
 us-west-1c
(1 row)

Usage in Row-level geo-partitioning

Similar to yb_server_region(), this function is also helpful while implementing Row-level geo-partitioning, as it can significantly simplify inserting rows from the user server's partition if the partitioning is based on default value of yb_server_zone().

Note

If you didn't set the placement_region flag at node startup, yb_server_region() returns NULL.

See also