473,472 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Index on date-fields with NULL values

Ik have created an index on a date field.
99% of all data in the table has a filled in date. 1 % is NULL
When I do a select with clause ... WHERE ADATE IS NULL,
Oracle does not use the index.

Is this correct? or How can I force Oracle to use the index.

Kind reagrds,
Aad.

PS: I am using Oracle 8.1.7 and 9.2
Jul 19 '05 #1
2 22890
"Aad Aldus" <a.*****@modality.nl> wrote in message news:<3f***********************@news.xs4all.nl>...
Ik have created an index on a date field.
99% of all data in the table has a filled in date. 1 % is NULL
When I do a select with clause ... WHERE ADATE IS NULL,
Oracle does not use the index.

Is this correct? or How can I force Oracle to use the index.

Kind reagrds,
Aad.

PS: I am using Oracle 8.1.7 and 9.2


This is correct. If all of the columns of an index are null that
record is not included in the index.
NULL means *nothing*.
Hence IS NULL will NEVER use an index.

You cannot force Oracle to use the index (this is documented behavior,
and has always worked this way) other than
- use a function based index (Oracle EE edition only, and in that case
-especially if only 1 percent is null- you are killing an insect with
a sledgehammer)
- use a dummy date for the null values

Regards

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
Aad Aldus wrote:
Ik have created an index on a date field.
99% of all data in the table has a filled in date. 1 % is NULL
When I do a select with clause ... WHERE ADATE IS NULL,
Oracle does not use the index.

Is this correct? or How can I force Oracle to use the index.

Kind reagrds,
Aad.

PS: I am using Oracle 8.1.7 and 9.2

Given that 99% of the table-data is returned by the query a Full table
scan is actually faster than using an index.


Michael Willer
Oracle/J2EE architect
Cyber Com Consulting a/s

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
8
by: David McDivitt | last post by:
I need to set tabs on java generated pages. Pages have four sections: header, sidebar, body, and footer. The sidebar and body change dynamically. The tab key must go to anchors, fields, and buttons...
4
by: ianv2 | last post by:
Hi Is the following possible using Javascript ? I would like a page to redirect to another page if the page expiry has passed. E.G. If my questionnaireform.html page had an expiry date...
5
by: Pedro Alves | last post by:
Hi. I'm having some trouble on the use of indexes. The querys below are exactly the same but refer to different months. One case uses indexes, the other doesn't. Is there anything I can do?...
3
by: Patrick Hatcher | last post by:
I have a timestamp field where I find I'm doing a lot of searching by date (YYYY-MM-DD) or using this field as a match to another table that has a date format. I wanted to create an index on the ...
1
by: William Bradley | last post by:
In a database I have a table that amongst other cells has a "current date" cell, and "expired date" cell and an "Index Number" cell. The "index number" cell contains code that converts the...
2
by: Thomas F.O'Connell | last post by:
I'm interested to know a little bit more about the postgres implementation of indexes. I'm specifically wondering what it means in the output of EXPLAIN when a filter is applied. I'm trying to...
5
by: Miquel van Smoorenburg | last post by:
I have a database with a btree index on the 'removed' field, which is of type 'date'. However it isn't being used: techdb2=> explain select * from lines where removed > CURRENT_DATE; QUERY PLAN...
6
by: db2admin | last post by:
hi, i have query doing tablescan instead index scan. i would explain situation in more detail. table has MDC on one column and three more regular indexes. now, one of the index which has three...
1
by: Steffen Stellwag | last post by:
Truely is often better to scan a table in full passing by an index , but if you can force the optimizer to use an index via a hint for testing and comparing the results. But the index in the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.