New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make update_osm_peak_point use incremental update #814 #896
Make update_osm_peak_point use incremental update #814 #896
Conversation
Results evaluating commit f21eeaf (merged with base 2b95d1c as 9c260f1). See run details. PostgreSQL DB size in MB: 2665 ⇒ 2669 (0.2% change)
expand for details...
|
I propose we solve #899 first -- this way we can test if these types of changes are ok to merge automatically. Anyone wants to tackle that? |
@frodrigo hi, i merged the conflict with your patch, but please double check the logic |
5bc00bf
to
57e70b1
Compare
Thank, I will make the similar others when I will have more free time. Probably in July. |
Awesome, thanks. |
Replacing update on the whole table with an update only on changed rows. The goal is to update more quickly by just updating the changing content. The update now focus on osm_id of changed rows, it use index. Add a where clause tags != update_tags(tags, geometry) en ensure only update when changed. It requires one more trigger and a table to store changed osm_id. The UPDATE is keep in a function to be reusable for initial setup and trigger update. I try many code layout before done it in this way with the goal to keep the code for initial pass and for update. It should have low impact on initial data load. Better performance for row update can be achieve with BEFORE UPDATE, but require to duplicate the logic. It is not based on the already merged #896 because calling and update within a function for each updated row was not efficient for larger table (like housenumber). It addresses #814. * Remake update_peak_point use incremental update #814 * Make update_aerodrome_label_point use incremental update #814 * Make housenumber_centroid use incremental update #814 * Make update_continent_point use incremental update #814 * Make update_island_point use incremental update #814 * Make update_island_polygon use incremental update #814 * Remove dead code in update_state_point.sql * Make update_state_point use incremental update #814 * Remove dead code in update_country_point.sql * Make update_country_point use incremental update #814 * Make osm_poi_polygon use incremental update #814 Thanks @frodrigo
Replacing update on the whole table with an update only on changed rows.
The goal is to update more quickly by just updating the changing content.
The update now focus on
osm_id
of changed rows, it use index. Add a where clausetags != update_tags(tags, geometry)
en ensure only update when changed.It now requires only one trigger in place of two.
The
UPDATE
is keep in a function to be reutilisable for initial setup and trigger update, the switch is done with(new_osm_id IS NULL OR osm_id = new_osm_id)
.It is a prof of concept. If it is ok, I will do batch of these on other similar updates.
It addresses #814.
Note:
update_tags
is already IMMUTABLE but can be switched to pure SQL and parallel safe https://github.com/openmaptiles/openmaptiles-tools/blob/master/sql/zzz_language.sql#L154