dbTalk Databases Forums  

not null and indexes

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss not null and indexes in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
vertigo
 
Posts: n/a

Default not null and indexes - 02-13-2005 , 05:41 AM






Hello

Does oracle create automaticly indexes on not null columns ?

Thanx
Michal


Reply With Quote
  #2  
Old   
Sybrand Bakker
 
Posts: n/a

Default Re: not null and indexes - 02-13-2005 , 05:58 AM






On Sun, 13 Feb 2005 12:41:07 +0100, vertigo <ax178 (AT) wp (DOT) pl> wrote:

Quote:
Hello

Does oracle create automaticly indexes on not null columns ?

Thanx
Michal
No


--
Sybrand Bakker, Senior Oracle DBA


Reply With Quote
  #3  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: not null and indexes - 02-13-2005 , 12:02 PM



vertigo (ax178 (AT) wp (DOT) pl) wrote:
: Hello

: Does oracle create automaticly indexes on not null columns ?

No.

But if you define constraints on a column then oracle may implement that
constraint using an index on the column.

Prime example being a primary key - it must be unique and a unique index
is used to enforce that - so in that case those columns will be in an
index. Also in that case, the columns involved will end up being not null
columns.




--

This space not for rent.

Reply With Quote
  #4  
Old   
Niall Litchfield
 
Posts: n/a

Default Re: not null and indexes - 02-13-2005 , 12:23 PM



"Malcolm Dew-Jones" <yf110 (AT) vtn1 (DOT) victoria.tc.ca> wrote

Quote:
vertigo (ax178 (AT) wp (DOT) pl) wrote:
: Hello

: Does oracle create automaticly indexes on not null columns ?

No.

But if you define constraints on a column then oracle may implement that
constraint using an index on the column.

Prime example being a primary key - it must be unique and a unique index
is used to enforce that - so in that case those columns will be in an
index. Also in that case, the columns involved will end up being not null
columns.
Isn't this the *only* such example. As such I'd view it as an exception.
Incidentally if the column is already indexed (even with a non-unique key)
then the index won't be created (and more to the point) dropped with the
constraint.


--
Niall Litchfield
Oracle DBA
http://www.niall.litchfield.dial.pipex.com




Reply With Quote
  #5  
Old   
Mark C. Stock
 
Posts: n/a

Default Re: not null and indexes - 02-13-2005 , 03:50 PM




"Niall Litchfield" <niall.litchfield (AT) dial (DOT) pipex.com> wrote

Quote:
"Malcolm Dew-Jones" <yf110 (AT) vtn1 (DOT) victoria.tc.ca> wrote in message
news:420f964e (AT) news (DOT) victoria.tc.ca...
vertigo (ax178 (AT) wp (DOT) pl) wrote:
: Hello

: Does oracle create automaticly indexes on not null columns ?

No.

But if you define constraints on a column then oracle may implement that
constraint using an index on the column.

Prime example being a primary key - it must be unique and a unique index
is used to enforce that - so in that case those columns will be in an
index. Also in that case, the columns involved will end up being not
null
columns.

Isn't this the *only* such example. As such I'd view it as an exception.
Incidentally if the column is already indexed (even with a non-unique key)
then the index won't be created (and more to the point) dropped with the
constraint.


--
Niall Litchfield
Oracle DBA
http://www.niall.litchfield.dial.pipex.com

Good addtional regarding the pre-existing index.

Clarification for those not familiar with this -- the behavior described
above is true for both PRIMARY KEY and UNIQUE constraints, but no other
constraints (i.e., not for CHECK, FOREIGN KEY REFERENCES or NOT NULL)

++ mcs




Reply With Quote
  #6  
Old   
Thomas Kyte
 
Posts: n/a

Default Re: not null and indexes - 02-13-2005 , 03:51 PM



In article <420f9b25$0$16585$cc9e4d1f (AT) news-text (DOT) dial.pipex.com>, Niall
Litchfield says...
Quote:
"Malcolm Dew-Jones" <yf110 (AT) vtn1 (DOT) victoria.tc.ca> wrote in message
news:420f964e (AT) news (DOT) victoria.tc.ca...
vertigo (ax178 (AT) wp (DOT) pl) wrote:
: Hello

: Does oracle create automaticly indexes on not null columns ?

No.

But if you define constraints on a column then oracle may implement that
constraint using an index on the column.

Prime example being a primary key - it must be unique and a unique index
is used to enforce that - so in that case those columns will be in an
index. Also in that case, the columns involved will end up being not null
columns.

Isn't this the *only* such example. As such I'd view it as an exception.
Incidentally if the column is already indexed (even with a non-unique key)
then the index won't be created (and more to the point) dropped with the
constraint.


well, there is that "unique" constraint as well

primary keys
unique constraints

they both will either utilize an existing index or create one -- either a unique
or non-unqiue index as appropriate (for deferrable or nondeferrable
constraints)....


--
Thomas Kyte
Oracle Public Sector
http://asktom.oracle.com/
opinions are my own and may not reflect those of Oracle Corporation


Reply With Quote
  #7  
Old   
DA Morgan
 
Posts: n/a

Default Re: not null and indexes - 02-17-2005 , 10:46 AM



vertigo wrote:

Quote:
Hello

Does oracle create automaticly indexes on not null columns ?

Thanx
Michal
No as Sybrand said but also Oracle does not index NULLs.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.