Skip to content

Commit 7be6f0c

Browse files
committed
Call ANALYZE on tables with ids when two-stage processing is used
For these tables a (temporary) index is created but an ANALYZE might help to speed up things.
1 parent 4066b2e commit 7be6f0c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/flex-table.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void table_connection_t::stop(bool updateable, bool append)
274274
}
275275

276276
log_info("Analyzing table '{}'...", table().name());
277-
analyze_table(*m_db_connection, table().schema(), table().name());
277+
analyze();
278278

279279
teardown();
280280
}
@@ -287,6 +287,11 @@ void table_connection_t::prepare()
287287
}
288288
}
289289

290+
void table_connection_t::analyze()
291+
{
292+
analyze_table(*m_db_connection, table().schema(), table().name());
293+
}
294+
290295
void table_connection_t::create_id_index()
291296
{
292297
if (m_id_index_created) {

src/flex-table.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ class table_connection_t
253253

254254
void prepare();
255255

256+
void analyze();
257+
256258
void create_id_index();
257259

258260
pg_result_t get_geom_by_id(osmium::item_type type, osmid_t id) const;

src/output-flex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,7 @@ void output_flex_t::reprocess_marked()
18251825
for (auto &table : m_table_connections) {
18261826
if (table.table().matches_type(osmium::item_type::way) &&
18271827
table.table().has_id_column()) {
1828+
table.analyze();
18281829
table.create_id_index();
18291830
}
18301831
}

0 commit comments

Comments
 (0)