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.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.