Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What was the purpose for which we created the index

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
barthwalsamarth

New User


Joined: 03 Aug 2006
Posts: 9

PostPosted: Mon Jun 11, 2007 7:40 pm    Post subject: What was the purpose for which we created the index
Reply with quote

Hi I am new to mainframes.
I have a doubt that why we need indexes.
Primary keys are used to identify unique rows but I read that index can be same for more than one row, then what was the purpose for which we created the index.

Thanks in advance!!!
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jun 11, 2007 7:49 pm    Post subject:
Reply with quote

Speed! Indexes are maintained in sequence and using an index avoids scanning the entire table looking for a value.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jun 11, 2007 8:14 pm    Post subject:
Reply with quote

Hello,

For this
Quote:
I read that index can be same for more than one row
an example might be in a "personnel" system.

Each person-id is unique, but let's say each department may have between 0 and many people assigned to it. If dept_no was a secondary key (index) a query could directly obtain all of the people assigned to that department and there would be no extra overhead traversing the entire table to return only those people assigned to the particular department(s) used in the WHERE. It could very quickly also determine that there were no people assigned to "that" department.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Several errors during building altern... Andi1982 JCL & VSAM 11 Wed Jul 06, 2016 7:39 pm
No new posts Drop building Alternate Index for a p... bhavin.mehta JCL & VSAM 6 Mon Jul 04, 2016 3:47 pm
No new posts VSAM Alternate Index in CICS jacobdng CICS 2 Fri May 06, 2016 1:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us