Memra

Save a query under a name and reuse it like a table.

A saved query

A view is a stored SELECT you can query like a table. It doesn't copy data — it runs underneath each time — so it's always live. Views tame complexity and give callers a clean, stable interface:

CREATE VIEW in_stock AS
  SELECT title, genre, stock FROM books WHERE stock > 0;

SELECT * FROM in_stock WHERE genre = 'science';

Drop with DROP VIEW. Use views to hide a gnarly join behind a friendly name, or to expose only certain columns.

your querySELECT * FROM in_stock WHERE genre = 'science'VIEW in_stockSELECT title, genre, stock FROM books WHERE stock > 0TABLE books10 rows — the only stored copywhat you writewhat runs
Nothing is stored in the middle band. Your WHERE and the view’s WHERE are merged by the planner into one query against books, which is why a view is always current and why an expensive view is expensive on every read.
NORMAL ~/memra/learn/postgresql/views utf-8 LF