dbTalk Databases Forums  

index

comp.databases comp.databases


Discuss index in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
aarklon@gmail.com
 
Posts: n/a

Default index - 07-28-2008 , 09:13 AM






Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table


2) index on the primary key can be clustered or non clustered


now my question is


To what extent these statements are true ?


Reply With Quote
  #2  
Old   
Carl Kayser
 
Posts: n/a

Default Re: index - 07-28-2008 , 09:37 AM







<aarklon (AT) gmail (DOT) com> wrote

Quote:
Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table


2) index on the primary key can be clustered or non clustered


now my question is


To what extent these statements are true ?

Which RDBMS? What do you mean by "To what extent"?

The above two statements are true for sybase ASE. I think that the first is
true for most RDBMS although the terminology may differ. (Oracle index
organized table = ASE clustered index.)




Reply With Quote
  #3  
Old   
Carl Kayser
 
Posts: n/a

Default Re: index - 07-28-2008 , 09:37 AM




<aarklon (AT) gmail (DOT) com> wrote

Quote:
Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table


2) index on the primary key can be clustered or non clustered


now my question is


To what extent these statements are true ?

Which RDBMS? What do you mean by "To what extent"?

The above two statements are true for sybase ASE. I think that the first is
true for most RDBMS although the terminology may differ. (Oracle index
organized table = ASE clustered index.)




Reply With Quote
  #4  
Old   
Carl Kayser
 
Posts: n/a

Default Re: index - 07-28-2008 , 09:37 AM




<aarklon (AT) gmail (DOT) com> wrote

Quote:
Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table


2) index on the primary key can be clustered or non clustered


now my question is


To what extent these statements are true ?

Which RDBMS? What do you mean by "To what extent"?

The above two statements are true for sybase ASE. I think that the first is
true for most RDBMS although the terminology may differ. (Oracle index
organized table = ASE clustered index.)




Reply With Quote
  #5  
Old   
Axel Hallez
 
Posts: n/a

Default Re: index - 07-29-2008 , 07:41 AM



aarklon (AT) gmail (DOT) com wrote:
Quote:
Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table
A non-clustered index, is a mini table that contains key-values and
rowid's. When accessing the table through the index you first look up
the rowid's that correspond to the key-value(s) you're looking for and
then use the rowid's to retrieve the records from the actual table.

With a clustered index, the index is not separate from the table, but
the records of the table are stored in the order of the index-key. This
means that when you lookup records through a clustered index you can
directly look into the table using the key-values you need.

Since you can store the records only in one order, you can have only one
clustered index per table.

Quote:
2) index on the primary key can be clustered or non clustered
This depends on the database system. relational theory does not
discriminate between candidate keys. Primary keys are a construct
stemming from implementation issues. If I recall correctly early RDBMS's
used the primary key to determine the storage order of records, thus
making it a clustered index.
Nowadays, many RDMS's allow to cluster on other keys.


Reply With Quote
  #6  
Old   
Axel Hallez
 
Posts: n/a

Default Re: index - 07-29-2008 , 07:41 AM



aarklon (AT) gmail (DOT) com wrote:
Quote:
Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table
A non-clustered index, is a mini table that contains key-values and
rowid's. When accessing the table through the index you first look up
the rowid's that correspond to the key-value(s) you're looking for and
then use the rowid's to retrieve the records from the actual table.

With a clustered index, the index is not separate from the table, but
the records of the table are stored in the order of the index-key. This
means that when you lookup records through a clustered index you can
directly look into the table using the key-values you need.

Since you can store the records only in one order, you can have only one
clustered index per table.

Quote:
2) index on the primary key can be clustered or non clustered
This depends on the database system. relational theory does not
discriminate between candidate keys. Primary keys are a construct
stemming from implementation issues. If I recall correctly early RDBMS's
used the primary key to determine the storage order of records, thus
making it a clustered index.
Nowadays, many RDMS's allow to cluster on other keys.


Reply With Quote
  #7  
Old   
Axel Hallez
 
Posts: n/a

Default Re: index - 07-29-2008 , 07:41 AM



aarklon (AT) gmail (DOT) com wrote:
Quote:
Hi all,

I read the following in a book


1) we can have several non clustered indexes on a table , but we can
have only one clustered index per table
A non-clustered index, is a mini table that contains key-values and
rowid's. When accessing the table through the index you first look up
the rowid's that correspond to the key-value(s) you're looking for and
then use the rowid's to retrieve the records from the actual table.

With a clustered index, the index is not separate from the table, but
the records of the table are stored in the order of the index-key. This
means that when you lookup records through a clustered index you can
directly look into the table using the key-values you need.

Since you can store the records only in one order, you can have only one
clustered index per table.

Quote:
2) index on the primary key can be clustered or non clustered
This depends on the database system. relational theory does not
discriminate between candidate keys. Primary keys are a construct
stemming from implementation issues. If I recall correctly early RDBMS's
used the primary key to determine the storage order of records, thus
making it a clustered index.
Nowadays, many RDMS's allow to cluster on other keys.


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.