If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > making index

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-16-07, 07:57
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 189
Smile making index

how can we choose that on which column is to make index to make search more efficient
Reply With Quote
  #2 (permalink)  
Old 07-16-07, 08:21
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You look at the WHERE clause of you queries. Columns mentioned there are good candidates for indexes.

Andy
Reply With Quote
  #3 (permalink)  
Old 07-16-07, 10:58
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Are you interested in the CREATE INDEX statement?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 07-17-07, 00:11
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by ankur02018
how can we choose that on which column is to make index to make search more efficient
DB2 (unlike some other databases) has an excellent optimizer, and should chose the correct index so long as it has accurate statistics (from a runstats command). If you don't think that DB2 is chosing the correct index, then open a problem with IBM support.

If DB2 choses the wrong access path because the number of rows in the table varies drastically within a short timespan, alter the table and set it to volatile.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 07-19-07, 23:57
gou007 gou007 is offline
Registered User
 
Join Date: Jun 2007
Posts: 12
hi ankur,

the Db2 design advisor can suggest you on on which indexes u can create for better performance.

db2advis -d database -s "sql statment"

u can get more about design advisor by refering this

http://www.ibm.com/developerworks/db...arthur/#design
Reply With Quote
  #6 (permalink)  
Old 07-20-07, 00:10
chaitu_onweb chaitu_onweb is offline
Registered User
 
Join Date: Dec 2006
Posts: 6
Hi,

You can actually see the columns on which the maximum number of hits are being done and decide the columns that require an index.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On