F.39. lt_standby_forward

F.39.1. Configuration Parameters
F.39.2. Usage
F.39.3. Authentication
F.39.4. Features/Limitations

lt_standby_forward is a module which forwards SQL statements from a hot standby to primary, providing a facility to reduce loading of primary, and to allow clients query from standby. For example, clients can send INSERT, CREATE to a hot standby.

F.39.1. Configuration Parameters

lt_standby_forward.enable_forward

It controls whether this feature is enabled or not user. Default is off. Set this option on standby, or for a single session.

F.39.2. Usage

You must add the line shown below in your lightdb.conf.

shared_preload_libraries = 'lt_standby_forward'

F.39.3. Authentication

lt_standby_forward uses primary_conninfo to connect to primary, appending current dbname and username (i.e. the db and user used to connect to standby) to primary_conninfo. The connection info looks like

primary_conninfo dbname=a_db user=a_user application_name=lt_standby_forward options='-c opt1=value1 -c opt2=value2'

It is not supported to set passward. Config lt_hba.conf on primary, or put password in passfile on standby to avoid typing password.

F.39.4. Features/Limitations

  • Forwards DELETE, UPDATE, INSERT, SELECT with modifying CTE to primary.

  • Forwards SELECT/CALL statements containing volatile function to primary, otherwise executes on standby.

  • Executes read only transactions on standby, otherwise forwards to primary.

  • DDL is not allowed in transactions.

  • View is rewriten (expanded) on standby before forwarding to primary. Query fails if view contains objects cannot be accessed by current user.

  • Executes SET on both sides, execute show on standby. Don't SET xxx_timeout after connection established, set these parameters with ltsql/jdbc parameter options. For ltsql/jdbc options, only statement_timeout, lock_timeout and idle_in_transaction_session_timeout will be pass to primary.

  • COPY FROM is not supported.

  • CREATE TEMP/UNLOGGED TABLE is not supported.

  • Utility commands not mentioned above are forwarded to primary.