[postgis-users] Refresh materialized view only when it's necessary
j.j.green at gmx.co.uk
Wed Apr 1 09:12:10 PDT 2020
> Hello, I need to refresh a materialized view in my database,
I've faced similar problems with complex derived data being too
much for a view and finding the lack of incremental update on
the standard PG materialised views means I could only update very
In the end, I managed to get a working solution with a "manually
materialised view", so this is just a regular table, and I have
triggers which wait for new data, and when they run they insert
the new suitably modified rows into that table.
This is _not easy_, there are lots of gotchas and edge-cases,
for my case the underlying problem was not too hard, it was just
that underlying data was too damn big.
The code was commercial, so I'm afraid I can't post it.
Bon chance !
More information about the postgis-users