查询执行在位图索引中花费更多时间

时间:2018-04-27 09:33:34

标签: sql oracle performance

我的桌子有100万条记录。我想从表中只获取非活动用户。查询执行需要10分钟以上。即使我是 使用索引。 STATUS只有两个值Y或N.所以我创建了该列的位图索引。

EXPLAIN PLAN FOR
SELECT CUSTOMER NAME,MOBILE NUMBER,ACCOUNT NUMBER,CUSTOMER ID,REGISTARTION DATE from REGISTRATION where STATUS='N';

Plan hash value: 2615581521

---------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                           | Name                      | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
---------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                    |                           |   960K|    66M|  9880   (1)| 00:01:59 |       |       |
|   1 |  PARTITION RANGE ALL                |                           |   960K|    66M|  9880   (1)| 00:01:59 |     1 |1048575|
|   2 |   PARTITION HASH ALL                |                           |   960K|    66M|  9880   (1)| 00:01:59 |     1 |     4 |
|   3 |    TABLE ACCESS BY LOCAL INDEX ROWID| REGISTRATION              |   960K|    66M|  9880   (1)| 00:01:59 |     1 |1048575|
|   4 |     BITMAP CONVERSION TO ROWIDS     |                           |       |       |            |          |       |       |
|*  5 |      BITMAP INDEX SINGLE VALUE      | IDX_REGISTRATION_7        |       |       |            |          |     1 |1048575|
---------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   5 - access("STATUS"='N')

Note
-----
   - dynamic sampling used for this statement (level=11)
-----------------------------------------------------------------------------------------------------------------------------------------------------

如何提高上述查询的性能?

0 个答案:

没有答案