Glossary · Databases

Database View

A database view is a saved query that behaves like a virtual table, simplifying complex queries and limiting what users can see.

Updated October 6, 2026

A database view is a stored query that you can select from as if it were a table. It stores the query definition, not a separate copy of the data, unless it is a materialized view.

Why it matters

Views hide complexity, give reports a stable interface even when the underlying tables change, and restrict access by exposing only certain columns or rows. Views are created with CREATE VIEW and queried like any table, and updatable views can even accept inserts under certain conditions. Materialized views store the computed result physically and must be refreshed, trading freshness for speed on expensive aggregations.

Example

CREATE VIEW active_customers AS
SELECT id, name, email
FROM customers
WHERE deleted_at IS NULL;

SELECT * FROM active_customers WHERE name LIKE 'A%';

Common mistakes

  • Stacking views on views until nobody can tell what query actually runs.
  • Expecting a normal view to be faster. It simply re-runs its query each time.
  • Forgetting to refresh a materialized view and serving stale numbers.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.