liveh2o / spectacles

ActiveRecord Views for PostgreSQL
MIT License
90 stars 11 forks source link

Need a way to concurrently refresh a materialized view #28

Closed moveson closed 4 years ago

moveson commented 4 years ago

The .refresh! method executes REFRESH MATERIALIZED VIEW for the subject table. But this command locks the table making it non-queryable during the refresh process.

Since Postgres 9.4, there has been a concurrent refresh option that allows the table to be queried during the refresh. (See https://www.postgresql.org/docs/9.4/sql-refreshmaterializedview.html). It would be good to have a method that accesses this concurrent option. The method might be called .refresh_concurrently!

moveson commented 4 years ago

Done in #30.