The REFRESH MATERIALIZED VIEW command in PostgreSQL updates a materialized view by locking it, recomputing its data from the underlying tables, replacing the old data with the new, and then unlocking it. This ensures users see consistent, up-to-date data. The process starts by locking the view to prevent access, then runs the query to get fresh data, replaces the stored data, and finally unlocks the view so it can be accessed again. The structure of the view does not change during refresh, only the data inside. If the refresh is interrupted before data replacement, the view keeps its old data. This command is useful to keep summary or aggregated data current without recalculating on every query.