With composite indexSQL> select count(1) from whdata.customer_dim where current_record_flg = 'Y' and effective_start_dt = to_date('19000101','YYYYMMDD');
COUNT(1)
----------
1712628
Elapsed: 00:00:01.57
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=8)
1 0 SORT (AGGREGATE)
2 1 PARTITION RANGE (SINGLE) (Cost=1 Card=7183 Bytes=57464)
3 2 BITMAP CONVERSION (COUNT) (Cost=1 Card=7183 Bytes=5746
4)
4 3 BITMAP INDEX (SINGLE VALUE) OF 'COMPOSITE_IDX_TEMP_B' (INDEX (BIT
MAP))
Statistics
----------------------------------------------------------
7903 recursive calls
0 db block gets
2449 consistent gets
249 physical reads
0 redo size
218 bytes sent via SQL*Net to client
280 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
197 sorts (memory)
0 sorts (disk)
1 rows processed
Without composite indexSQL> select count(1) from whdata.customer_dim where current_record_flg = 'Y' and effective_start_dt = to_date('19000101','YYYYMMDD');
COUNT(1)
----------
1712628
Elapsed: 00:18:56.62
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1 Bytes=8)
1 0 SORT (AGGREGATE)
2 1 PARTITION RANGE (SINGLE) (Cost=2 Card=7183 Bytes=57464)
3 2 INDEX (UNIQUE SCAN) OF 'CUSTOMER_DIM_PK' (INDEX (UNIQU
E)) (Cost=2 Card=7183 Bytes=57464)
4 3 BITMAP CONVERSION (TO ROWIDS)
5 4 BITMAP AND
6 5 BITMAP INDEX (SINGLE VALUE) OF 'CUSTOMER_DIM_B5_
R' (INDEX (BITMAP))
7 5 BITMAP INDEX (SINGLE VALUE) OF 'CUSTOMER_DIM_B1_
R' (INDEX (BITMAP))
Statistics
----------------------------------------------------------
395 recursive calls
0 db block gets
5142876 consistent gets
87890 physical reads
0 redo size
234 bytes sent via SQL*Net to client
280 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
13 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> quit
QUOTE (burleson @ Jul 31 2008, 08:54 PM)

>> Why does it take SO much longer
Obviously, becaus it is reading every block in the IOT.
Can you post the exact SQL and run them again in SQL*Plus with "set autotrace on"?
That will give more details on I/O.
It is also interesting that it is doing more than 5 million gets when using 2 bitmap indexes. One would think that since the SQL contains an "AND" condition, Oracle would do an index scan on the first condition and use that resultset to run the next condition, thereby querying a much smaller subset of records, and not scan through almost the entire table.