Commit c885922
committed
Append mode: Do not try to delete objects that can't exist in middle
When osm2pgsql runs in append mode it deletes all objects for which it
gets new versions from the middle tables before then adding the new
version. For a typical diff many of these deletes will be unnecessary
because the objects are new. With this commit the behaviour changes
slightly: We first get the maximum id from the nodes/ways/relations
middle tables. This operation is fast, because the PostgreSQL max()
function is aware of the btree index on those tables. Later, before we
delete an object we check the id against that maximum id, if it is
larger the object can't be in the table and we don't do the delete.
(Note that in theory we could use the fact that an object has version
number 1 to figure out that it must be new. But this is much less robust
than what we are doing here, for instance when the diff overlaps with
the original import.)1 parent 3f927c0 commit c885922
2 files changed
+39
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
181 | 193 | | |
182 | 194 | | |
183 | 195 | | |
| |||
790 | 802 | | |
791 | 803 | | |
792 | 804 | | |
793 | | - | |
| 805 | + | |
794 | 806 | | |
795 | 807 | | |
796 | 808 | | |
| |||
1049 | 1061 | | |
1050 | 1062 | | |
1051 | 1063 | | |
1052 | | - | |
1053 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
1054 | 1069 | | |
1055 | 1070 | | |
1056 | 1071 | | |
| |||
1189 | 1204 | | |
1190 | 1205 | | |
1191 | 1206 | | |
1192 | | - | |
1193 | | - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1194 | 1211 | | |
1195 | 1212 | | |
1196 | 1213 | | |
| |||
1283 | 1300 | | |
1284 | 1301 | | |
1285 | 1302 | | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
1286 | 1313 | | |
1287 | 1314 | | |
1288 | 1315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
0 commit comments