Reputation: 137
We have a function that is quite often triggered and make a query to a remote db. If I am not wrong the connection persist just in the scope of the current call/session of the function. Is it possible to make a global connection to a remote db and reuse this connection on each function call?
Performance issue we are facing is that for transfering just 3 records a query takes more than 1s.
Upvotes: 0
Views: 1303
Reputation: 61666
The doc for dblink_connect
says:
The connection will persist until closed or until the database session is ended.
So it's designed to be reused across function calls. Just reuse it.
Upvotes: 1