|
26 | 26 | #include "node-ram-cache.hpp" |
27 | 27 | #include "options.hpp" |
28 | 28 | #include "osmtypes.hpp" |
| 29 | +#include "pgsql-helper.hpp" |
29 | 30 | #include "util.hpp" |
30 | 31 |
|
31 | 32 | /** |
@@ -607,13 +608,29 @@ void middle_pgsql_t::relation_delete(osmid_t osm_id) |
607 | 608 | m_db_copy.delete_object(osm_id); |
608 | 609 | } |
609 | 610 |
|
610 | | -void middle_pgsql_t::analyze() |
| 611 | +void middle_pgsql_t::after_nodes() |
611 | 612 | { |
612 | | - for (auto const &table : m_tables) { |
613 | | - m_db_connection.exec("ANALYZE {}"_format(table.name())); |
| 613 | + m_db_copy.sync(); |
| 614 | + if (m_options->flat_node_file.empty()) { |
| 615 | + auto const &table = m_tables[NODE_TABLE]; |
| 616 | + analyze_table(m_db_connection, table.schema(), table.name()); |
614 | 617 | } |
615 | 618 | } |
616 | 619 |
|
| 620 | +void middle_pgsql_t::after_ways() |
| 621 | +{ |
| 622 | + m_db_copy.sync(); |
| 623 | + auto const &table = m_tables[WAY_TABLE]; |
| 624 | + analyze_table(m_db_connection, table.schema(), table.name()); |
| 625 | +} |
| 626 | + |
| 627 | +void middle_pgsql_t::after_relations() |
| 628 | +{ |
| 629 | + m_db_copy.sync(); |
| 630 | + auto const &table = m_tables[REL_TABLE]; |
| 631 | + analyze_table(m_db_connection, table.schema(), table.name()); |
| 632 | +} |
| 633 | + |
617 | 634 | middle_query_pgsql_t::middle_query_pgsql_t( |
618 | 635 | std::string const &conninfo, std::shared_ptr<node_ram_cache> const &cache, |
619 | 636 | std::shared_ptr<node_persistent_cache> const &persistent_cache) |
@@ -658,8 +675,6 @@ void middle_pgsql_t::commit() |
658 | 675 | m_copy_thread->finish(); |
659 | 676 | } |
660 | 677 |
|
661 | | -void middle_pgsql_t::flush() { m_db_copy.sync(); } |
662 | | - |
663 | 678 | void middle_pgsql_t::stop(thread_pool_t &pool) |
664 | 679 | { |
665 | 680 | m_cache.reset(); |
|
0 commit comments