Sorry iv figured that one out, the extra consistent gets... im using 2 objects the index and the table, so its going to be more? right?
I have a bigger problem now, and iv put this on a couple of forums but people are stumped.
I have tried running a test on a table which contains a 'sex' field... (table around 500 rows (300ish = F, 150ish = M, 50ish = null ---in the sex column)
When i place a bitmap index on the sex column, it is never used, no idea why?
I have read a blog post (link below and my results) and tried to incorporate this, it still will not use the index, I have also tried to force it using hints, still no luck
Any ideas?
Name Null Type
------------------------------ -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PERSONID NOT NULL NUMBER(9)
INACTIVEREASONID NUMBER(9)
WORKCATID NUMBER(9)
ORIGINID NUMBER(9)
AGENCYID NUMBER(9)
PAGERNO VARCHAR2(20)
FNAME VARCHAR2(20)
SNAME VARCHAR2(20)
SEX VARCHAR2(1)
================================================== ================
The data in the sex field is split m/f/null
================================================== ================
im using the following query:
select fname, sname, personid from tblperson where sex = 'F';
================================================== ================
adding the following index and running the SQL i get these results:
create bitmap index i_person_sex on tblperson(sex);
================================================== ================
Execution Plan
----------------------------------------------------------
---------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
---------------------------------------------------------------
| 0 | SELECT STATEMENT | | 323 | 6783 | 7 |
| 1 | TABLE ACCESS FULL| TBLPERSON | 323 | 6783 | 7 |
---------------------------------------------------------------
Note
-----
- 'PLAN_TABLE' is old version
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
45 consistent gets
0 physical reads
0 redo size
9458 bytes sent via SQL*Net to client
647 bytes received via SQL*Net from client
23 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
323 rows processed
timing for: timer13
Elapsed: 00:00:00.01
================================================== =====
Then changing the index to compensate for null's : create bitmap index i_person_sex on tblperson(sex,0);
this info taken from here:
http://oratips-ddf.blogspot.com/2008...o-indexes.html================================================== ====
Execution Plan
----------------------------------------------------------
---------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
---------------------------------------------------------------
| 0 | SELECT STATEMENT | | 323 | 6783 | 7 |
| 1 | TABLE ACCESS FULL| TBLPERSON | 323 | 6783 | 7 |
---------------------------------------------------------------
Note
-----
- 'PLAN_TABLE' is old version
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
45 consistent gets
0 physical reads
0 redo size
9458 bytes sent via SQL*Net to client
647 bytes received via SQL*Net from client
23 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
323 rows processed
timing for: timer13
Elapsed: 00:00:00.00
================================================== =================================
after further testing i have noticed....
The two following queries do use the index:
==========================================
select sex from tblperson;
select sex from tblperson where sex = 'F'
==========================================
However these two dont use the index...
==========================================
select fname from tblperson where sex = 'F';
select fname, sex from tblperson where sex = 'F';
==========================================
Crazy?!?!