Loading topic
SELECT, but they differ in what the database keeps on disk and when the rows are computed. This chapter builds a working model of that difference. Later chapters cover 6 min readpsql available. It covers the creation command: its syntax, what happens when it runs, and the rules the new object follows. Refreshing, indexing, and7 min readCREATE MATERIALIZED VIEW, and that you know basic transactions and locks in PostgreSQL. It covers what REFRESH MATERIALIZED VIEW does, what it locks, and the errors you are most likely to meet. Two later chapters cover CONCURRENTLY a6 min readCREATE MATERIALIZED VIEW. You should also know what a B-tree index is and how to read a basic EXPLAIN plan.7 min readREFRESH MATERIALIZED VIEW. It also assumes you know what a unique index is and can read basic psql output. You will learn why a plain refresh blocks readers, how CONCURRENTLY avoids that, what it requires, and what it cost6 min readREFRESH MATERIALIZED VIEW, and add a unique index. It uses the orders table and the sales_daily view from earlier chapters. The aim is to choose a refresh strategy deliberately, not by habit.7 min readCREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW, and that you know what a unique index is. It covers the WITH NO DATA clause. This clause creates a materialized view's definition without running its query, which is useful for migrations, dumps an7 min readREFRESH MATERIALIZED VIEW. PostgreSQL has no built-in way to do that on a timer, so something outside the view has to issue the command. This chapter covers the options for that, using pg_cron as the main example, and the problems a scheduled refresh6 min readpg_matviews6 min readorders table and the sales_daily view from those chapters. You shou7 min readREFRESH MATERIALIZED VIEW and the CONCURRENTLY variant. It covers what the built-in feature cannot do and what you can use when it falls short.7 min readREFRESH MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW CONCURRENTLY. It also assumes you can read an EXPLAIN ANALYZE plan. The earlier chapters covered the mechanics. This one7 min read