mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Improve purge performance for PostgreSQL with large databases (#133699)
This commit is contained in:
@ -600,6 +600,12 @@ def setup_connection_for_dialect(
|
||||
execute_on_connection(dbapi_connection, "SET time_zone = '+00:00'")
|
||||
elif dialect_name == SupportedDialect.POSTGRESQL:
|
||||
max_bind_vars = DEFAULT_MAX_BIND_VARS
|
||||
# PostgreSQL does not support a skip/loose index scan so its
|
||||
# also slow for large distinct queries:
|
||||
# https://wiki.postgresql.org/wiki/Loose_indexscan
|
||||
# https://github.com/home-assistant/core/issues/126084
|
||||
# so we set slow_range_in_select to True
|
||||
slow_range_in_select = True
|
||||
if first_connection:
|
||||
# server_version_num was added in 2006
|
||||
result = query_on_connection(dbapi_connection, "SHOW server_version")
|
||||
|
Reference in New Issue
Block a user