S

How to Use Materialized Views in PostgreSQL

For a complex SQL query, it is impractical to rewrite the entire query every time its results are needed. **Views** solve this problem. A view is a named (pre-defined) query and a pseudo-table with the output of that query. The code to make a view based on a query looks like this: -- pseudocode CREATE VIEW my_view AS SELECT ... FROM ... JOIN ... ON ... WHERE ... AND ... ORDER BY ... LIMIT ... Essentially, the query is prepended wit......

Comments