sosm / osmhistorydb-ch

ISC License
3 stars 2 forks source link

Performance Tuning, especially when counting deletions (the FIXME case) #17

Open sfkeller opened 2 years ago

sfkeller commented 2 years ago

The views on the database are sometimes slow with complex queries, especially when counting deletions - as in the "FIXME case" (counting removed FIXMEs).

Therefore, the PostgreSQL database must be specifically examined for performance bottlenecks by applying EXPLAIN ANALYZE and e.g. pgtune, type conversions (datetime) and read optimizations (e.g. CREATE UNLOGGED TABLE...).

Another hint (source: https://www.crunchydata.com/blog/performance-and-spatial-joins):

SHOW max_worker_processes;            -- 8?
SHOW max_parallel_workers;            -- 8?
SHOW max_parallel_workers_per_gather; -- 2?
SHOW min_parallel_table_scan_size;    -- 8MB?

Then try

SET max_parallel_workers_per_gather = 8;
SET min_parallel_table_scan_size = '1kB';
lbuchli commented 1 year ago

Work done:

sfkeller commented 1 year ago

Thanks @lbuchli

Use periodically refreshed materialized views for data storage, allow these updates to occur concurrently to database requests.

Resolved in https://gitlab.ost.ch/ifs/geometalab/potm/ (currently a private repo)

Developement of a new, more accurate query specialized on counting deletions

Ok. So let's leave this issue open until we really can cover this edge case.