Use the EXECUTE command to send a raw SQL query directly to a configured Peer. This bypasses PeerDB’s query-rewriting layer and sends the provided query text to the remote database behind the named peer.Documentation Index
Fetch the complete documentation index at: https://docs.peerdb.io/llms.txt
Use this file to discover all available pages before exploring further.
Syntax
<peer_name>must be the name of an existing peer.<query_text>is a string literal containing the SQL to run on the remote peer.
Examples
Run a simple select on a Postgres peer:Behavior
- The query text is forwarded verbatim to the remote database connection associated with the peer.
- Results are returned to the caller exactly as the remote database would return them.
Considerations
- The remote query runs with the credentials configured for the peer. Ensure the peer’s credentials have the minimal privileges required.
- Since the query runs directly on the remote system, it can modify data or schema. Be cautious when running DDL or DML via
EXECUTEin production environments. - The query must use the dialect and capabilities of the remote database type.

