Commit 9ce15e5
committed
Disable sequential scan on database tables in copy threads
This forces the DELETEs to use an index scan which is much faster.
The underlying problem here is probably that the DELETEs are called for
all OSM objects in the input file, regardless of whether they are even
in the table. For most tables most ids will not be in there. So
PostgreSQL overestimates the number of "hits" it is going to get and
thinks a full table scan is more efficient when in fact an index lookup
is much better.
The COPYs used in the same database connection are not affected by this.
In many tests I have done I only see this problem in some cases, but
when it hits it can slow down processing considerably. This could
explain the occasional slow processing that some people have been
reporting over the years and that we could never really nail down
(#1674, #1971).1 parent fb6bd80 commit 9ce15e5
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
134 | 142 | | |
135 | 143 | | |
136 | 144 | | |
| |||
0 commit comments