30th September 2021: PostgreSQL 14 Released!
Supported Versions: Current (14) / 13 / 12 / 11 / 10 / 9.6
Development Versions: devel
Unsupported versions: 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3



dblink_send_query -- sends an async query to a remote database


dblink_send_query(text connname, text sql) returns int


dblink_send_query sends a query to be executed asynchronously, that is, without immediately waiting for the result. There must not be an async query already in progress on the connection.

After successfully dispatching an async query, completion status can be checked with dblink_is_busy, and the results are ultimately collected with dblink_get_result. It is also possible to attempt to cancel an active async query using dblink_cancel_query.



Name of the connection to use.


The SQL statement that you wish to execute in the remote database, for example select * from pg_class.

Return Value

Returns 1 if the query was successfully dispatched, 0 otherwise.


SELECT dblink_send_query('dtest1', 'SELECT * FROM foo WHERE f1 < 3');

Submit correction

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.