底层sql查询中的oracle索引
的表
我有一个包含 2 列item_name varchar2 Brand varchar2
它们都有位图索引
假设我为特定品牌创建一个视图并重命名列 item_name ,类似于
create view my_brand as select item_name as item from table x where Brand='x'
我们无法在普通视图上创建索引,但是在发出该视图的基础查询时 Oracle 正在做什么?如果我们编写 select item from my_brand where item='item1' ,是否会使用 item_name 列的索引?
谢谢
I have a table with 2 columns
item_name varchar2
brand varchar2
both of them have bitmap index
let's say I create a view for a specific brand and rename the column item_name ,something like that
create view my_brand as
select item_name as item from table x where brand='x'
We cannot create an index on a normal view but what is Oracle doing when issuing the underlying query of that view? Is the index of the item_name column being used if we write select item from my_brand where item='item1'?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案将是“视情况而定”。索引访问路径当然是优化器开放的一个选项;但请记住,优化器会做出基于成本的决策。因此,本质上它将评估所有可用计划的成本并选择成本最低的计划。
这是一个例子:
The answer will be “it depends”. The index access path is certainly an option open to the optimizer; but remember that the optimizer makes a cost based decision. So essentially it will evaluate the cost of all the available plans and choose the one with the lowest cost.
Here is an example:
不,你不能
No, you can't