表与视图的性能 [英] Performance of Tables vs. Views

查看:64
本文介绍了表与视图的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近开始使用一个数据库,在该数据库中,约定是为每个表创建一个视图.如果您假设表和视图之间存在一对一的映射,那么我想知道是否有人可以告诉我这样做的性能影响.顺便说一句,这是在Oracle上.

Recently started working with a database in which the convention is to create a view for every table. If you assume that there is a one to one mapping between tables and views, I was wondering if anyone could tell me the performance impacts of doing something like this. BTW, this is on Oracle.

推荐答案

假设问题是关于非实例化视图的,实际上取决于视图所基于的查询以及对其执行的操作.有时,谓词可以由优化器推入视图查询中.如果不是这样,那将不如表格本身好.视图建立在表格之上-为什么您期望性能会更好?

Assuming the question is about non-materialized views -- Really depends on the query that the view is based on, and what is being done to it. Sometimes, the predicates can be pushed into the view query by the optimizer. If not, then it wouldn't be as good as against the table itself. Views are built on top of tables -- why would you expect that the performance would be better?

在一个视图之上构建一个视图的分层视图是一种不好的做法,因为您要等到运行时才能知道问题.分层视图中发生谓词推送的可能性也较小.

Layering views, where you build one view on top of another, is a bad practice because you won't know about issues until run time. It's also less of a chance that predicate pushing will occur with layered views.

视图也可以更新-如果某人对基​​础表具有INSERT/UPDATE/DELETE特权,则它们不是限制访问资源的可靠方法.

Views can also be updateable -- they aren't a reliable means to restricting access to resources if someone has INSERT/UPDATE/DELETE privileges on the underlying tables.

材料化视图与表格一样好,但是众所周知,它们支持的内容受到限制.

Materialized views are as good as tables, but are notoriously restrictive in what they support.

这篇关于表与视图的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆