xelixdev / django-pgviews-redux

Fork of django-postgres that focuses on maintaining and improving support for Postgres SQL Views.
The Unlicense
64 stars 15 forks source link

Enable refresh materialized views with atomic swap #29

Open mikicz opened 1 year ago

mikicz commented 1 year ago

Add an option to refresh materialized views with an atomic swap. When the refresh starts, it would create a new materialized view (with some temp name), and when it is created, it would run an atomic deletion of the old materialized view, and renaming of the new view to the correct name.

This could reduce the number of vacuums PostgreSQL is doing. It may also allow the view to be created without using the concurrent flag, which should be faster.

radusuciu commented 8 months ago

This would be a great feature, especially for larger materialized views.