Skip to content

Cache connections to external query engines #970

Backlog

Description

@sfc-gh-agedemenli

Follow-up from the review of #914.

Every scan of a pg_lake_remote table opens a new connection to its query engine, and closes it when the statement ends. That's cheap for an engine on a local socket. An engine on another host, though, pays for a TCP connection, a TLS handshake and authentication on every scan, and a query that reads several of its tables pays it once per table.

As in postgres_fdw, connections could be cached per backend, keyed by server and user mapping, and reused across statements. That needs:

  • invalidation when the server or the user mapping changes;
  • discarding a connection that failed, or that a cancelled or aborted transaction left in an unknown state;
  • keeping the session settings pg_lake sends on a connection, such as TimeZone, right on a reused connection;
  • a way to list and close cached connections, like postgres_fdw_get_connections() and postgres_fdw_disconnect().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions