由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 一道面试题,求助
相关主题
请教一个SQL Server的面试题求教mysql数据库构建
再出一道面试题Oracle question
怎么去除duplicates怎样解决 Index for NULL value
beijing呀,教教我怎么optimize sql server吧。高手请进
Oracle char AND varchar2 datatype question.how to display all exsiting indexes and their statistics
一个oracle performance 的问题。plsql 求救--速度太慢了, 咋办呢
这二句为什么会抛出ClassCastException异常?问一道sql的面试题啊 自己实在是没想出来
一个oracle query, 求问[转载] 求教数据库的query optimization 工作的面试
相关话题的讨论汇总
话题: index话题: test话题: name话题: scan话题: range
进入Database版参与讨论
1 (共1页)
b*****d
发帖数: 15
1
We have the following schema of a table:
create table Test (id number, name varchar2(32), desc varchar2(400));
create index index_test on Test (name);
Which of the following statements will invoke an index scan by oracle
execution plan
a) select * from test where name='name';
b) select * from test where name like 'name%';
c) select * from test where name like '%name';
d) select * from test where name like '%name%'
a9
发帖数: 21638
2
a b?

【在 b*****d 的大作中提到】
: We have the following schema of a table:
: create table Test (id number, name varchar2(32), desc varchar2(400));
: create index index_test on Test (name);
: Which of the following statements will invoke an index scan by oracle
: execution plan
: a) select * from test where name='name';
: b) select * from test where name like 'name%';
: c) select * from test where name like '%name';
: d) select * from test where name like '%name%'

B*****g
发帖数: 34098
3
ab
---
没事请勿往下看
憋了半天,还是抬个杠,desc是reserved word的,所以create table那个script会
fail

【在 a9 的大作中提到】
: a b?
b*****d
发帖数: 15
4
可以解释一下吗?
谢谢!

【在 B*****g 的大作中提到】
: ab
: ---
: 没事请勿往下看
: 憋了半天,还是抬个杠,desc是reserved word的,所以create table那个script会
: fail

B*****g
发帖数: 34098
5
解释ab 还是 杠?

【在 b*****d 的大作中提到】
: 可以解释一下吗?
: 谢谢!

B*****g
发帖数: 34098
6
其实想一想B-tree的工作原理就明白了
http://docs.oracle.com/cd/E11882_01/server.112/e16638/optimops.
1
11.2.3.3.1 When the Optimizer Uses Index Range Scans
The optimizer uses a range scan when it finds one or more leading columns of
an index specified in conditions, such as the following:
col1 = :b1
col1 < :b1
col1 > :b1
AND combination of the preceding conditions for leading columns in the index
col1 like 'ASD%' wild-card searches should not be in a leading position othe
rwise the condition col1 like '%ASD' does not result in a range scan
Range scans can use unique or non-unique indexes. Range scans avoid sorting
when index columns constitute the ORDER BY/GROUP BY clause.

script会

【在 B*****g 的大作中提到】
: 解释ab 还是 杠?
v***e
发帖数: 2108
7
For a and b, you will see a plan like this. Note the index range scan,
----------------------------------------------------------------------------
----------------------
| Id | Operation | Name | Rows | Bytes |
Cost (%CPU)| Time |
----------------------------------------------------------------------------
----------------------
| 0 | SELECT STATEMENT | | 1 | 233 |
1 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID BATCHED| TEST | 1 | 233 |
1 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | INDEX_TEST | 1 | |
1 (0)| 00:00:01 |
----------------------------------------------------------------------------
----------------------
for c and d, it is usually a full table scan,

【在 b*****d 的大作中提到】
: We have the following schema of a table:
: create table Test (id number, name varchar2(32), desc varchar2(400));
: create index index_test on Test (name);
: Which of the following statements will invoke an index scan by oracle
: execution plan
: a) select * from test where name='name';
: b) select * from test where name like 'name%';
: c) select * from test where name like '%name';
: d) select * from test where name like '%name%'

1 (共1页)
进入Database版参与讨论
相关主题
[转载] 求教数据库的query optimization 工作的面试Oracle char AND varchar2 datatype question.
Join optimization一个oracle performance 的问题。
求一本书的电子版,抱怨一下SQL Server Optimizer这二句为什么会抛出ClassCastException异常?
sqlserver Query的问题一个oracle query, 求问
请教一个SQL Server的面试题求教mysql数据库构建
再出一道面试题Oracle question
怎么去除duplicates怎样解决 Index for NULL value
beijing呀,教教我怎么optimize sql server吧。高手请进
相关话题的讨论汇总
话题: index话题: test话题: name话题: scan话题: range