Oracle數據庫: 我有一個有400000行的表。 我爲field1創建索引。 下面的查詢仍然很慢(700毫秒):Oracle - 索引似乎不起作用。仍然緩慢
select field1, field2
from table
where
field1 = '0903400110106156' or
field1 = '0903400110106160' or
field1 = '0903400110106190' or
field1 = '0903400110106471' or
field1 = '0903400110106480' or
field1 = '0903400110106494' or
field1 = '0903500110100001' or
field1 = '0903500110100012' or
field1 = '0903500110100021' or
field1 = '0903500110100031' or
field1 = '0903500110100039' or
field1 = '0903500110100047' or
field1 = '0903500110100050'
我刪除索引,我仍然得到700毫秒。 我再次創建索引,我仍然獲得700毫秒。 有什麼問題?
的創建索引的語句:
CREATE INDEX myindex
ON table (field1)
編輯:解釋計劃
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
-----------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 4 | 60 | 2 |
|* 1 | TABLE ACCESS FULL | table | 4 | 60 | 2 |
-----------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("table"."field1"='0901690339400674')
Note: cpu costing is off
EDIT2:OK,我做了2代表的表分析。 table1有速度問題。儘管其大小與table1相似,但table2速度更快(10msec而不是700msec)。奇怪的速度問題!請幫助...
chk Owner Name Partition Subpartition Tablespace NumRows Blocks EmptyBlocks AvgSpace ChainCnt AvgRowLen AvgSpaceFLBlocks NumFLBlocks UserStats GlobalStats LastAnalyzed SampleSize Monitoring Status PartType PartInfo IsExternal
TRUE user table1 tablespace 484627 6858 182 878 777 103 NO NO 15/3/2011 18:34 125977 NO Normal, Successful Completion FALSE
TRUE user table2 tablespace 366159 6480 176 786 16565 130 NO NO 15/3/2011 18:34 89657 NO Normal, Successful Completion FALSE
是什麼解釋說? – 2011-03-15 14:43:26
查詢的執行計劃是什麼樣的。它是否提到你的索引? – 0xCAFEBABE 2011-03-15 14:43:46