diff --git a/src/db-copy.cpp b/src/db-copy.cpp index 3a63a8587..d024f5697 100644 --- a/src/db-copy.cpp +++ b/src/db-copy.cpp @@ -130,9 +130,6 @@ void db_copy_thread_t::thread_t::operator()() try { m_conn = std::make_unique(m_connection_params); - // Let commits happen faster by delaying when they actually occur. - m_conn->exec("SET synchronous_commit = off"); - // Disable sequential scan on database tables in the copy threads. // The copy threads only do COPYs (which are unaffected by this // setting) and DELETEs which we know benefit from the index. For diff --git a/src/flex-table.cpp b/src/flex-table.cpp index d9d0111d5..4b14e795e 100644 --- a/src/flex-table.cpp +++ b/src/flex-table.cpp @@ -246,7 +246,6 @@ void table_connection_t::connect(connection_params_t const &connection_params) assert(!m_db_connection); m_db_connection = std::make_unique(connection_params); - m_db_connection->exec("SET synchronous_commit = off"); } static void enable_check_trigger(pg_conn_t const &db_connection, diff --git a/src/pgsql.cpp b/src/pgsql.cpp index 617470621..3a530495f 100644 --- a/src/pgsql.cpp +++ b/src/pgsql.cpp @@ -73,6 +73,11 @@ pg_conn_t::pg_conn_t(connection_params_t const &connection_params) if (!get_logger().debug_enabled()) { exec("SET client_min_messages = WARNING"); } + + // Disable synchronous_commit on all connections. For some connections it + // might not matter, especially if they read only, but then it doesn't + // hurt either. + exec("SET synchronous_commit = off"); } void pg_conn_t::close() diff --git a/src/table.cpp b/src/table.cpp index f0d021180..911223599 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -67,8 +67,6 @@ void table_t::sync() { m_copy.sync(); } void table_t::connect() { m_sql_conn = std::make_unique(m_connection_params); - //let commits happen faster by delaying when they actually occur - m_sql_conn->exec("SET synchronous_commit = off"); } void table_t::start(connection_params_t const &connection_params,