- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Indexes over columns without NOT NULL constrai...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2002 02:22 AM
тАО09-06-2002 02:22 AM
Indexes over columns without NOT NULL constraint, do them work?
We made several tests with individual indexes over columns created without NOT NULL constraint.
We realized that kind of indexes (individual) are not used by oracle when you make a query.
I.E. select column from table where value=3 will not use an individual index created over "column" if NOT NULL constraint is not defined for the column.
Is this an oracle rule even if the whole columns have a not null value?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2002 03:35 AM
тАО09-06-2002 03:35 AM
Re: Indexes over columns without NOT NULL constraint, do them work?
If the amount of data (number of rows) in the table are small, the optimiser may choose to just scan the table sequentially, rather than looking up the index first.
It depends to a large extent on the type of data you have. If the table has only a few rows, and most of them have NULL values in the indexed column, there is little value in going through the index.
Some Database Products allow you to "coax" the optimiser to use an index. Informix, for example, allows you to use optimiser hints which will force the use of a particular index for the query. But this will not necessarily give you better performance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 06:26 PM
тАО09-10-2002 06:26 PM
Re: Indexes over columns without NOT NULL constraint, do them work?
This also depends on when you analyzed the table last as well, as it gives a proportion of what data is found in the table. If "select * from tableA where colA = '3'" is run against a table with 10 rows in it, it will do a full table scan. If there are 100 rows, it will most likely do a index scan (provided that there is an index against colA).
Null data is still data, just data that is listed as null, and indexes work on this data the same as a normal NOT NULL row.
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 10:13 PM
тАО09-10-2002 10:13 PM
Re: Indexes over columns without NOT NULL constraint, do them work?
if you are using the cost-based optimizer, make sure that your statistics are not too old.
you may wish to use either of the following:
e.g.
analyze table t
compute statistics
for TABLE
for all indexes
or
exec dbms_stats.gather_table_stats(user,'T',method_opt=>'for all indexed columns',cascade=>true);
Also, as the others have mentioned the cost-based optimizer might choose to do a full-scan instead of an indexed scan. It depends on your statistics.
Don't forget that you can also force the query to use the index by using hints.
lastly, don't forget that use of indexes are highly dependent on the SQL query that you have written...
Hope this helps!
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 11:12 PM
тАО09-10-2002 11:12 PM
Re: Indexes over columns without NOT NULL constraint, do them work?
As far as I can understand from your answers, null column indexes could work with cost-optimizer mode. The only thing we have to take care is to keep stats as newer as possible.
What happen with the rule-optimizer mode?
I think it??s out of date from oracle 8i but it??s still in use on older versions.
Thanks for help.