We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fb6bd80 + 9ce15e5 commit 3091e78Copy full SHA for 3091e78
1 file changed
src/db-copy.cpp
@@ -131,6 +131,14 @@ void db_copy_thread_t::thread_t::operator()()
131
// Let commits happen faster by delaying when they actually occur.
132
m_conn->exec("SET synchronous_commit = off");
133
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
+
142
bool done = false;
143
while (!done) {
144
std::unique_ptr<db_cmd_t> item;
0 commit comments