router_mode: PROXY.
If the router has only one shard, set query_routing.always_check_rules to true;
otherwise, these queries are forwarded directly to PostgreSQL.
__spqr__is_ready()
Returns the router’s readiness status as a boolean.__spqr__shards()
Lists the shards in SPQR metadata, with one row per shard and a singletext
column named shard name.
SELECT * FROM __spqr__show('shards_extended');.
__spqr__show(target)
Runs a router console SHOW command. Pass the target as a lowercase string, for example'key_ranges'.
Both forms return one row per key range:
text:
Use the function in
FROM to select columns and filter rows:
ORDER BY works only when postprocessing is enabled in one of these ways:
- Set
query_routing.allow_postprocessingtotruein the router configuration. - Run
SET __spqr__allow_postprocessing TO truefor the current session. - Add the
/* __spqr__allow_postprocessing: true */query hint.
__spqr__host_status(host)
Returns a host’s cached read-write status. Pass the host address, including its port, as a string literal:text columns: host is the address, and rw is 'true' for
a writable host or 'false' otherwise. The call fails if the host has no cached
health check result.