Skip to main content

PostgreSQL Variables

info

Note: Changes made to the configuration on this page must be explicitly loaded to the runtime to take effect. Please refer to the Admin Commands documentation for details on the LOAD and SAVE commands.

List of PostgreSQL Variables

NOTE: You can click on the variable name to jump to its definition

Variable NameDefault Value
pgsql-auditlog_filenameNULL
pgsql-auditlog_filesize104857600
pgsql-aurora_max_lag_ms_only_read_from_replicas2
pgsql-authentication_method3
pgsql-auto_increment_delay_multiplex5
pgsql-auto_increment_delay_multiplex_timeout_ms10000
pgsql-autocommit_false_is_transactionfalse
pgsql-autocommit_false_not_reusablefalse
pgsql-automatic_detect_sqlifalse
pgsql-binlog_reader_connect_retry_msec3000
pgsql-client_host_cache_size0
pgsql-client_host_error_counts0
pgsql-commands_statstrue
pgsql-connect_retries_delay1
pgsql-connect_retries_on_failure10
pgsql-connect_timeout_client10000
pgsql-connect_timeout_server1000
pgsql-connect_timeout_server_max10000
pgsql-connection_delay_multiplex_ms0
pgsql-connection_max_age_ms0
pgsql-connection_warmingfalse
pgsql-default_max_latency_ms1000
pgsql-default_query_delay0
pgsql-default_query_timeout86400000
pgsql-default_reconnecttrue
pgsql-default_schemainformation_schema
pgsql-enforce_autocommit_on_readsfalse
pgsql-eventslog_default_log0
pgsql-eventslog_filenameNULL
pgsql-eventslog_filesize104857600
pgsql-eventslog_format1
pgsql-firewall_whitelist_enabledfalse
pgsql-free_connections_pct10
pgsql-handle_unknown_charset1
pgsql-have_compresstrue
pgsql-have_ssltrue
pgsql-hostgroup_manager_verbose1
pgsql-init_connectNULL
pgsql-interfaces0.0.0.0:6132
pgsql-kill_backend_connection_when_disconnectfalse
pgsql-log_unhealthy_connectionstrue
pgsql-long_query_time1000
pgsql-max_allowed_packet67108864
pgsql-max_connections2048
pgsql-max_stmts_cache10000
pgsql-max_stmts_per_connection20
pgsql-max_transaction_idle_time14400000
pgsql-max_transaction_time14400000
pgsql-min_num_servers_lantency_awareness1000
pgsql-mirror_max_concurrency16
pgsql-mirror_max_queue_length32000
pgsql-multiplexingtrue
pgsql-ping_interval_server_msec10000
pgsql-ping_timeout_server200
pgsql-poll_timeout2000
pgsql-poll_timeout_on_failure100
pgsql-query_cache_handle_warnings0
pgsql-query_cache_size_mb256
pgsql-query_cache_soft_ttl_pct0
pgsql-query_cache_stores_empty_resulttrue
pgsql-query_digeststrue
pgsql-query_digests_grouping_limit1000
pgsql-query_digests_keep_commentfalse
pgsql-query_digests_lowercasefalse
pgsql-query_digests_max_digest_length2048
pgsql-query_digests_max_query_length65000
pgsql-query_digests_no_digitsfalse
pgsql-query_digests_normalize_digest_textfalse
pgsql-query_digests_replace_nullfalse
pgsql-query_digests_track_hostnamefalse
pgsql-query_processor_iterations0
pgsql-query_processor_regex1
pgsql-query_retries_on_failure1
pgsql-server_encodingUTF8
pgsql-server_version16.1
pgsql-sessions_sortfalse
pgsql-set_parser_algorithm2
pgsql-set_query_lock_on_hostgroup1
pgsql-shun_on_failures5
pgsql-shun_recovery_time_sec10
pgsql-stats_time_backend_queryfalse
pgsql-stats_time_query_processorfalse
pgsql-tcp_keepalive_time120
pgsql-threshold_query_length524288
pgsql-threshold_resultset_size4194304
pgsql-throttle_connections_per_sec_to_hostgroup1000000
pgsql-throttle_max_bytes_per_second_to_client0
pgsql-throttle_ratio_server_to_client0
pgsql-unshun_algorithm0
pgsql-use_tcp_keepalivetrue
pgsql-verbose_query_errorfalse
pgsql-wait_timeout28800000

pgsql-auditlog_filename

Base filename for the PostgreSQL audit log.

System VariableNamepgsql-auditlog_filename
DynamicYes
Permitted ValuesTypeString
DefaultNULL

Description: The full path and base name for the files where PostgreSQL audit logs will be stored.

pgsql-auditlog_filesize

Maximum size of the PostgreSQL audit log file.

System VariableNamepgsql-auditlog_filesize
DynamicYes
Permitted ValuesTypeInteger (bytes)
Default104857600
Minimum1048576
Maximum1073741824

Description: Specifies the size limit for individual PostgreSQL audit log files before they are rotated.

pgsql-aurora_max_lag_ms_only_read_from_replicas

Description: Not supported.

pgsql-authentication_method

Defines the authentication method ProxySQL should use for backend connections.

System VariableNamepgsql-authentication_method
DynamicYes
Permitted ValuesTypeInteger
Default3
Minimum1
Maximum3

Description: Configures the authentication protocol used between ProxySQL and backend PostgreSQL servers. Common values: 1 (No Password), 2 (Clear Text), 3 (SASL/SCRAM).

pgsql-auto_increment_delay_multiplex

Number of queries to disable multiplexing after an insert with auto-increment.

System VariableNamepgsql-auto_increment_delay_multiplex
DynamicYes
Permitted ValuesTypeInteger
Default5
Minimum0
Maximum1000000

Description: Temporarily disables multiplexing for a session after an auto-increment value is generated, ensuring subsequent queries see the new value.

pgsql-auto_increment_delay_multiplex_timeout_ms

Description: Not supported.

pgsql-autocommit_false_is_transaction

Description: Not supported.

pgsql-autocommit_false_not_reusable

Description: Not supported.

pgsql-automatic_detect_sqli

Enables automatic detection of SQL injection attempts for PostgreSQL.

System VariableNamepgsql-automatic_detect_sqli
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: When enabled, ProxySQL analyzes PostgreSQL queries for potential SQL injection patterns and takes action based on configured rules.

pgsql-binlog_reader_connect_retry_msec

Description: Not supported.

pgsql-client_host_cache_size

Size of the cache for PostgreSQL client host information.

System VariableNamepgsql-client_host_cache_size
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum1048576

Description: Configures the maximum number of entries in the client host cache, used for tracking client-specific errors and connection attempts.

pgsql-client_host_error_counts

Threshold for consecutive errors from a client host before taking action.

System VariableNamepgsql-client_host_error_counts
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum1048576

Description: Specifies the number of connection errors allowed from a specific client host before ProxySQL begins blocking or limiting further connections from that source.

pgsql-commands_stats

Enables collection of command-level statistics for PostgreSQL.

System VariableNamepgsql-commands_stats
DynamicYes
Permitted ValuesTypeBoolean
Defaulttrue

Description: Controls whether ProxySQL tracks performance metrics for individual PostgreSQL command types.

pgsql-connect_retries_delay

Delay in milliseconds between connection retry attempts.

System VariableNamepgsql-connect_retries_delay
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default1
Minimum0
Maximum10000

Description: Sets the pause time between consecutive attempts to connect to a PostgreSQL backend server.

pgsql-connect_retries_on_failure

The number of times ProxySQL will retry connecting to a backend server before giving up.

System VariableNamepgsql-connect_retries_on_failure
DynamicYes
Permitted ValuesTypeInteger
Default10
Minimum0
Maximum1000

Description: Defines the maximum number of retry attempts for establishing a new connection to a backend server.

pgsql-connect_timeout_client

Timeout in milliseconds for client connections to ProxySQL during PostgreSQL protocol handshake establishment.

System VariableNamepgsql-connect_timeout_client
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default10000
Minimum500
Maximum3600000

Description: The maximum time ProxySQL will wait for a client to complete the PostgreSQL protocol handshake and establish a connection. This timeout is enforced when a client connection is in CONNECTING_CLIENT status and encompasses the entire connection establishment process, including SSL negotiation if enabled.

pgsql-connect_timeout_server

Default timeout in milliseconds for connecting to PostgreSQL backend servers.

System VariableNamepgsql-connect_timeout_server
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default1000
Minimum100
Maximum100000000

Description: The default timeout for establishing connections from ProxySQL to PostgreSQL backend servers. This timeout applies to all new connections initiated by ProxySQL and can be overridden per-hostgroup or per-server configuration.

pgsql-connect_timeout_server_max

Maximum timeout in milliseconds for connecting to PostgreSQL backend servers. This variable enforces an absolute upper limit on connection attempts to prevent indefinite blocking.

System VariableNamepgsql-connect_timeout_server_max
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default10000
Minimum100
Maximum100000000

Description: The maximum timeout for connecting from ProxySQL to PostgreSQL backends in a hostgroup. When ProxySQL tries to establish a connection to a backend, individual attempts can timeout after pgsql-connect_timeout_server milliseconds, and ProxySQL will retry according to pgsql-connect_retries_on_failure and pgsql-connect_retries_delay. However, when the cumulative time reaches pgsql-connect_timeout_server_max milliseconds, all retry attempts cease and an error is returned to the client with the message "Max connect timeout reached while reaching hostgroup...".

pgsql-connection_delay_multiplex_ms

Delay in milliseconds before enabling multiplexing for a new connection.

System VariableNamepgsql-connection_delay_multiplex_ms
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum300000

Description: Specifies a delay (in milliseconds) after a connection is established before it can be used for multiplexing. This can be useful for applications that set session variables immediately after connecting.

pgsql-connection_max_age_ms

Maximum age in milliseconds for a backend connection.

System VariableNamepgsql-connection_max_age_ms
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum86400000

Description: The maximum time (in milliseconds) a backend connection can stay open. Once this limit is reached, the connection is closed and a new one is established. A value of 0 disables this feature. Connections are only checked and removed when they become idle; active connections are not interrupted regardless of age.

pgsql-connection_warming

Enables background connection establishment to keep the connection pool "warm".

System VariableNamepgsql-connection_warming
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: When enabled, ProxySQL will proactively open connections to backend servers to ensure a minimum number of connections are always ready for incoming requests.

pgsql-default_max_latency_ms

Default maximum latency for backend PostgreSQL servers.

System VariableNamepgsql-default_max_latency_ms
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default1000
Minimum0
Maximum1728000000

Description: The default maximum latency allowed for a PostgreSQL backend server before it is considered too far and excluded from the routing pool.

pgsql-default_query_delay

Description: Not supported.

pgsql-default_query_timeout

Default timeout in milliseconds for PostgreSQL queries.

System VariableNamepgsql-default_query_timeout
DynamicYes
Permitted ValuesTypeInteger
Default86400000
Minimum1000
Maximum1728000000

Description: The default maximum time ProxySQL will wait for a query to complete if no timeout is specified in the query rules. When exceeded, the running query is terminated on the backend server and the client receives a query error. This limit applies per-query, measured from when the query is sent to the backend.

pgsql-default_reconnect

Description: Not supported.

pgsql-default_schema

Description: Not supported.

pgsql-enforce_autocommit_on_reads

Description: Not supported.

pgsql-eventslog_default_log

Description: Not supported.

pgsql-eventslog_filename

Base filename for the PostgreSQL events log.

System VariableNamepgsql-eventslog_filename
DynamicYes
Permitted ValuesTypeString
DefaultNULL

Description: The full path and base name for the files where PostgreSQL event logs will be stored.

pgsql-eventslog_filesize

Maximum size of the PostgreSQL events log file.

System VariableNamepgsql-eventslog_filesize
DynamicYes
Permitted ValuesTypeInteger (bytes)
Default104857600
Minimum1048576
Maximum1073741824

Description: Defines the maximum size allowed for PostgreSQL event log files before rotation.

pgsql-eventslog_format

Format of the PostgreSQL events log.

System VariableNamepgsql-eventslog_format
DynamicYes
Permitted ValuesTypeInteger
Default1
Minimum1
Maximum1

Description: Sets the logging format for PostgreSQL events. Currently, only format 1 (Binary) is supported.

pgsql-firewall_whitelist_enabled

Enables the firewall whitelist for PostgreSQL.

System VariableNamepgsql-firewall_whitelist_enabled
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: When enabled, ProxySQL enforces a whitelist of allowed PostgreSQL queries, blocking any that are not explicitly permitted.

pgsql-free_connections_pct

The percentage of open idle connections to keep in the connection pool.

System VariableNamepgsql-free_connections_pct
DynamicYes
Permitted ValuesTypeInteger
Default10
Minimum0
Maximum100

Description: Controls the percentage of idle connections that ProxySQL maintains in the connection pool relative to max_connections. This helps in managing resource usage while keeping enough connections ready for new requests. ProxySQL will remove excess free connections when the idle pool exceeds this percentage threshold, ensuring that backend connections are available for reuse without consuming unnecessary resources.

pgsql-handle_unknown_charset

Description: Not supported.

pgsql-have_compress

Description: Not supported.

pgsql-have_ssl

Indicates PostgreSQL SSL support availability and configuration status.

System VariableNamepgsql-have_ssl
DynamicNo
Permitted ValuesTypeBoolean
Defaulttrue

Description: Read-only variable indicating whether ProxySQL was compiled with SSL support for PostgreSQL connections. This variable serves as a gateway indicator that must be true for all PostgreSQL SSL functionality to operate, including client-to-proxy and proxy-to-server encryption.

pgsql-hostgroup_manager_verbose

Enables verbose logging for the PostgreSQL hostgroup manager.

System VariableNamepgsql-hostgroup_manager_verbose
DynamicYes
Permitted ValuesTypeInteger
Default1
Minimum0
Maximum3

Description: Controls the verbosity of logs generated by the PostgreSQL hostgroup management module. Higher values provide more detailed information.

pgsql-init_connect

SQL strings to be executed when a new backend connection is established.

System VariableNamepgsql-init_connect
DynamicYes
Permitted ValuesTypeString
DefaultNULL

Description: A string of one or more SQL statements to be executed by ProxySQL for each PostgreSQL client that connects.

pgsql-interfaces

Network interfaces to listen on for PostgreSQL client connections.

System VariableNamepgsql-interfaces
DynamicYes
Permitted ValuesTypeString
Default0.0.0.0:6132
MinimumN/A
MaximumN/A

Description: Comma-separated list of IP addresses and ports that ProxySQL should listen on for PostgreSQL client connections. This variable controls the PostgreSQL protocol listener interfaces and is dynamic, meaning changes take effect immediately without requiring a ProxySQL restart.

pgsql-kill_backend_connection_when_disconnect

Kills the backend connection immediately upon client disconnect.

System VariableNamepgsql-kill_backend_connection_when_disconnect
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: If enabled, ProxySQL will close the associated backend connection as soon as the client disconnects, rather than returning it to the pool. When disabled (default), backend connections remain available in the pool for reuse by other clients, which improves performance through connection reuse. When enabled, each client gets a fresh backend connection, which may increase connection overhead to the backend servers.

pgsql-log_unhealthy_connections

Controls whether ProxySQL logs unhealthy connections to PostgreSQL backends.

System VariableNamepgsql-log_unhealthy_connections
DynamicYes
Permitted ValuesTypeBoolean
Defaulttrue

Description: When enabled, ProxySQL logs details about connection attempts to backend servers that fail or are deemed unhealthy.

pgsql-long_query_time

Threshold in milliseconds for slow query logging.

System VariableNamepgsql-long_query_time
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default1000
Minimum0
Maximum1728000000

Description: If a query takes longer than this value to execute, it is considered a slow query and the slow query counter is incremented. This only affects statistics collection visible in stats_pgsql_query_digest; queries are NOT terminated based on this threshold. Use pgsql-default_query_timeout or query rule timeouts to terminate long-running queries.

pgsql-max_allowed_packet

Maximum size of a single network packet for PostgreSQL.

System VariableNamepgsql-max_allowed_packet
DynamicYes
Permitted ValuesTypeInteger
Default67108864
Minimum8192
Maximum1073741824

Description: Sets the upper limit for the size of a single PostgreSQL protocol packet that ProxySQL will handle.

pgsql-max_connections

Maximum number of concurrent client connections for PostgreSQL protocol.

System VariableNamepgsql-max_connections
DynamicYes
Permitted ValuesTypeInteger
Default2048
Minimum1
Maximum1000000

Description: Maximum number of concurrent PostgreSQL client connections that ProxySQL will accept and maintain. This critical limit protects both ProxySQL and backend PostgreSQL servers from resource exhaustion while providing predictable system capacity.

pgsql-max_stmts_cache

Maximum number of prepared statements to cache per thread.

System VariableNamepgsql-max_stmts_cache
DynamicYes
Permitted ValuesTypeInteger
Default10000
Minimum128
Maximum1048576

Description: Limits the total number of PostgreSQL prepared statements that can be cached across all backend connections within a single thread.

pgsql-max_stmts_per_connection

Maximum number of prepared statements per backend connection.

System VariableNamepgsql-max_stmts_per_connection
DynamicYes
Permitted ValuesTypeInteger
Default20
Minimum1
Maximum1024

Description: Limits how many unique prepared statements a single backend connection can maintain simultaneously.

pgsql-max_transaction_idle_time

Maximum time a transaction can be idle in PostgreSQL.

System VariableNamepgsql-max_transaction_idle_time
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default14400000
Minimum1000
Maximum1728000000

Description: Specifies the maximum duration (in milliseconds) a PostgreSQL transaction can remain idle before ProxySQL terminates the connection. When a transaction is idle longer than this threshold, the client connection is terminated to prevent resource leaks. Only applies to sessions with active transactions; sessions without active transactions are controlled by pgsql-wait_timeout instead.

pgsql-max_transaction_time

Maximum duration for a PostgreSQL transaction.

System VariableNamepgsql-max_transaction_time
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default14400000
Minimum1000
Maximum1728000000

Description: Sets the absolute maximum time (in milliseconds) a PostgreSQL transaction is allowed to run before being terminated. This is a hard limit that applies to the total duration of a transaction, measured from when the first statement begins. When exceeded, the client connection is terminated regardless of whether the transaction is currently active or idle.

pgsql-min_num_servers_lantency_awareness

Description: Not supported.

pgsql-mirror_max_concurrency

Maximum concurrent requests for mirrored sessions.

System VariableNamepgsql-mirror_max_concurrency
DynamicYes
Permitted ValuesTypeInteger
Default16
Minimum1
Maximum8192

Description: Limits the number of simultaneous mirrored sessions to prevent resource exhaustion during traffic mirroring.

pgsql-mirror_max_queue_length

Maximum number of queries queued for mirroring.

System VariableNamepgsql-mirror_max_queue_length
DynamicYes
Permitted ValuesTypeInteger
Default32000
Minimum0
Maximum1048576

Description: Sets the upper limit for the number of PostgreSQL queries waiting in the mirror queue. New mirroring requests are dropped if this limit is reached.

pgsql-multiplexing

Global switch for PostgreSQL connection multiplexing.

System VariableNamepgsql-multiplexing
DynamicYes
Permitted ValuesTypeBoolean
Defaulttrue

Description: Master toggle for PostgreSQL multiplexing. When enabled, ProxySQL can reuse backend connections for different client sessions when they are in an idle state.

pgsql-ping_interval_server_msec

Interval in milliseconds for sending ping checks to PostgreSQL backends.

System VariableNamepgsql-ping_interval_server_msec
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default10000
Minimum1000
Maximum604800000

Description: The frequency at which ProxySQL sends internal pings to PostgreSQL backend servers to maintain connection health.

pgsql-ping_timeout_server

Timeout in milliseconds for internal PostgreSQL backend pings.

System VariableNamepgsql-ping_timeout_server
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default200
Minimum10
Maximum600000

Description: The maximum time ProxySQL will wait for a response to an internal ping before considering the backend connection timed out.

pgsql-poll_timeout

Description: Controls how frequently the worker thread checks for network activity on client and backend connections. This is the maximum time the thread will wait for new events before processing queued tasks and performing maintenance. Lower values reduce latency at the cost of increased CPU usage; higher values improve CPU efficiency but may delay response to network events.

pgsql-poll_timeout_on_failure

Wait time in milliseconds after a polling error.

System VariableNamepgsql-poll_timeout_on_failure
DynamicYes
Permitted ValuesTypeInteger (milliseconds)
Default100
Minimum10
Maximum20000

Description: The duration ProxySQL will wait before re-polling after a connection or network failure occurs during PostgreSQL traffic handling. When backend connections cannot be established, the poll timeout is temporarily reduced to this value to detect connection establishment or failure more quickly. Once connections are established, the normal pgsql-poll_timeout is restored.

pgsql-query_cache_handle_warnings

Controls whether queries that generate warnings are cached.

System VariableNamepgsql-query_cache_handle_warnings
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum1

Description: When set to 1, ProxySQL will cache query results even if they include warnings. If set to 0, queries with warnings are not cached.

pgsql-query_cache_size_mb

Size of the PostgreSQL query cache in megabytes.

System VariableNamepgsql-query_cache_size_mb
DynamicYes
Permitted ValuesTypeInteger (MB)
Default256
Minimum0
Maximum10240

Description: Configures the total amount of memory allocated for caching PostgreSQL query results.

pgsql-query_cache_soft_ttl_pct

Description: Not supported.

pgsql-query_cache_stores_empty_result

Controls whether the PostgreSQL query cache should store empty resultsets.

System VariableNamepgsql-query_cache_stores_empty_result
DynamicYes
Permitted ValuesTypeBoolean
Defaulttrue

Description: When enabled, ProxySQL will cache query results that return zero rows. This can be beneficial for reducing backend load for queries that frequently return no data.

pgsql-query_digests

Enables or disables PostgreSQL query digest collection.

System VariableNamepgsql-query_digests
DynamicYes
Permitted ValuesTypeBoolean
Defaulttrue

Description: When enabled, ProxySQL collects query digests for PostgreSQL traffic, which are visible in the stats_pgsql_query_digest table.

pgsql-query_digests_grouping_limit

Limit for the number of parameters to group in a single query digest.

System VariableNamepgsql-query_digests_grouping_limit
DynamicYes
Permitted ValuesTypeInteger
Default1000
Minimum1
Maximum2089

Description: Controls the maximum number of parameters ProxySQL will consolidate when generating a normalized query digest for PostgreSQL.

pgsql-query_digests_keep_comment

Description: Not supported.

pgsql-query_digests_lowercase

Converts queries to lowercase before digest calculation.

System VariableNamepgsql-query_digests_lowercase
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: If set to true, PostgreSQL queries are normalized to lowercase before generating their digest.

pgsql-query_digests_max_digest_length

Maximum length of the generated query digest text.

System VariableNamepgsql-query_digests_max_digest_length
DynamicYes
Permitted ValuesTypeInteger
Default2048
Minimum16
Maximum1048576

Description: Defines the maximum number of characters ProxySQL will store for a normalized PostgreSQL query digest.

pgsql-query_digests_max_query_length

Maximum query length to be considered for digest calculation.

System VariableNamepgsql-query_digests_max_query_length
DynamicYes
Permitted ValuesTypeInteger
Default65000
Minimum16
Maximum1048576

Description: Queries longer than this value will be truncated before being processed for digest generation.

pgsql-query_digests_no_digits

Description: Not supported.

pgsql-query_digests_normalize_digest_text

Description: Not supported.

pgsql-query_digests_replace_null

Description: Not supported.

pgsql-query_digests_track_hostname

Description: Not supported.

pgsql-query_processor_iterations

Description: Not supported.

pgsql-query_processor_regex

Description: Not supported.

pgsql-query_retries_on_failure

The number of times a query is retried upon failure.

System VariableNamepgsql-query_retries_on_failure
DynamicYes
Permitted ValuesTypeInteger
Default1
Minimum0
Maximum1000

Description: Defines how many times ProxySQL will attempt to re-execute a query if it fails due to a connection error with the backend. When a query fails on a connection error, ProxySQL automatically retries the query on a new backend connection up to this many times before returning an error to the client. Query rules can override this default value by specifying a custom retry count.

pgsql-server_encoding

The default encoding that ProxySQL assumes for the server.

System VariableNamepgsql-server_encoding
DynamicYes
Permitted ValuesTypeString
DefaultUTF8

Description: Sets the default server encoding. ProxySQL uses UTF8 by default.

pgsql-server_version

The PostgreSQL server version that ProxySQL will report to clients.

System VariableNamepgsql-server_version
DynamicYes
Permitted ValuesTypeString
Default16.1

Description: This variable sets the version string that ProxySQL reports to clients during the handshake. It defaults to 16.1.

pgsql-sessions_sort

Enables sorting of PostgreSQL sessions for processing.

System VariableNamepgsql-sessions_sort
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: When enabled, ProxySQL sorts active PostgreSQL sessions before processing them, which can optimize performance by improving CPU cache locality on systems with many concurrent connections. Sessions are sorted by their connection timeout status to prioritize sessions that are closer to their timeout limits. This does not affect routing behavior or query execution order.

pgsql-set_parser_algorithm

Description: Not supported.

pgsql-set_query_lock_on_hostgroup

Controls routing locks when a session variable is set.

System VariableNamepgsql-set_query_lock_on_hostgroup
DynamicYes
Permitted ValuesTypeInteger
Default1
Minimum0
Maximum1

Description: When enabled (1), setting a session variable will "lock" the session to the current hostgroup to ensure consistency for subsequent queries.

pgsql-shun_on_failures

The number of connection failures allowed before a backend server is shunned.

System VariableNamepgsql-shun_on_failures
DynamicYes
Permitted ValuesTypeInteger
Default5
Minimum0
Maximum10000000

Description: If a backend server fails to respond to connection attempts this many times consecutively, it will be temporarily shunned (marked as OFFLINE) to prevent further traffic from being sent to it. During the shun period, new connections are automatically directed to other healthy backends in the same hostgroup. The server will be automatically returned to service after pgsql-shun_recovery_time_sec seconds.

pgsql-shun_recovery_time_sec

The duration in seconds a backend server remains shunned.

System VariableNamepgsql-shun_recovery_time_sec
DynamicYes
Permitted ValuesTypeInteger
Default10
Minimum0
Maximum31536000

Description: The time in seconds that a backend server will remain in the shunned state before ProxySQL attempts to use it again. After this time elapses, the server is automatically returned to ONLINE status and new connections will be directed to it again. Existing connections to the server are allowed to complete naturally during the shun period.

pgsql-stats_time_backend_query

Description: Not supported.

pgsql-stats_time_query_processor

Description: Not supported.

pgsql-tcp_keepalive_time

Sets the TCP keepalive idle time for PostgreSQL client connections.

System VariableNamepgsql-tcp_keepalive_time
DynamicYes
Permitted ValuesTypeInteger (seconds)
Default120
Minimum0
Maximum7200

Description: Defines the time (in seconds) the connection must be idle before TCP starts sending keepalive probes.

pgsql-threshold_query_length

Description: Not supported.

pgsql-threshold_resultset_size

Threshold in bytes for PostgreSQL resultset buffering.

System VariableNamepgsql-threshold_resultset_size
DynamicYes
Permitted ValuesTypeInteger (bytes)
Default4194304
Minimum0
Maximum2147483647

Description: Determines the maximum amount of data (in bytes) that ProxySQL will buffer for a single PostgreSQL resultset before it begins streaming results to the client.

pgsql-throttle_connections_per_sec_to_hostgroup

Limits the number of new backend connections per second per hostgroup.

System VariableNamepgsql-throttle_connections_per_sec_to_hostgroup
DynamicYes
Permitted ValuesTypeInteger
Default1000000
Minimum1
Maximum100000000

Description: Controls the rate at which ProxySQL opens new connections to PostgreSQL backends in a specific hostgroup to prevent connection storms.

pgsql-throttle_max_bytes_per_second_to_client

Maximum network bandwidth per second for a client connection.

System VariableNamepgsql-throttle_max_bytes_per_second_to_client
DynamicYes
Permitted ValuesTypeInteger (bytes/sec)
Default0
Minimum0
Maximum2147483647

Description: Limits the outgoing traffic rate (bytes per second) from ProxySQL to each PostgreSQL client. A value of 0 disables throttling.

pgsql-throttle_ratio_server_to_client

Ratio for network bandwidth throttling between backend and client.

System VariableNamepgsql-throttle_ratio_server_to_client
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum100

Description: Defines the bandwidth allocation ratio between backend connections and client connections when throttling is active.

pgsql-unshun_algorithm

Defines the algorithm used to decide when a shunned server should be moved back ONLINE.

System VariableNamepgsql-unshun_algorithm
DynamicYes
Permitted ValuesTypeInteger
Default0
Minimum0
Maximum1

Description: Determines the recovery logic for backend servers that were previously shunned due to errors.

pgsql-use_tcp_keepalive

Enables TCP keepalive for PostgreSQL client connections.

System VariableNamepgsql-use_tcp_keepalive
DynamicYes
Permitted ValuesTypeBoolean
Defaulttrue

Description: Enables the SO_KEEPALIVE socket option for PostgreSQL frontend connections.

pgsql-verbose_query_error

Provides detailed PostgreSQL error messages to the client.

System VariableNamepgsql-verbose_query_error
DynamicYes
Permitted ValuesTypeBoolean
Defaultfalse

Description: When enabled, ProxySQL returns more descriptive error information to PostgreSQL clients when a query fails.

pgsql-wait_timeout

Timeout in milliseconds for idle client connections.

System VariableNamepgsql-wait_timeout
DynamicYes
Permitted ValuesTypeInteger
Default28800000
Minimum0
Maximum1728000000

Description: The maximum time (in milliseconds) a PostgreSQL client connection can remain idle before ProxySQL closes it. This limit only applies to connections with no active transaction. Connections with idle transactions are controlled by pgsql-max_transaction_idle_time instead.


Apply your changes: Remember to use the appropriate LOAD and SAVE commands to activate and persist your configuration. See the complete Admin Commands reference.