File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,14 @@ void db_copy_thread_t::thread_t::operator()()
131131 // Let commits happen faster by delaying when they actually occur.
132132 m_conn->exec (" SET synchronous_commit = off" );
133133
134+ // Disable sequential scan on database tables in the copy threads.
135+ // The copy threads only do COPYs (which are unaffected by this
136+ // setting) and DELETEs which we know benefit from the index. For
137+ // some reason PostgreSQL chooses in some cases not to use that index,
138+ // possibly because the DELETEs get a large list of ids to delete of
139+ // which many are not in the table which confuses the query planner.
140+ m_conn->exec (" SET enable_seqscan = off" );
141+
134142 bool done = false ;
135143 while (!done) {
136144 std::unique_ptr<db_cmd_t > item;
You can’t perform that action at this time.
0 commit comments