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 > index on one columntable

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-09, 05:54
sahana sahana is offline
Registered User
 
Join Date: Sep 2003
Posts: 36
index on one columntable

a table XYZ with single column of datatype char (3) is involved with join with another table that has a indexed predicate. the table XYX has no index defined on it, and the explain statemen resulted in tablespace scan and would like to know if it is advisable to create unique index on the one column table so that Index space scan is taken. pls advice.
Rgds
Roger
Reply With Quote
  #2 (permalink)  
Old 09-03-09, 06:12
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
It may be beneficial because index entries are sorted and, thus, DB2 can narrow down the search scope - which it can't do in a table scan, typically. However, if the table only contains a few rows, then it won't give you much benefit (if any).
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 09-03-09, 08:20
sahana sahana is offline
Registered User
 
Join Date: Sep 2003
Posts: 36
yes I agree with you, but the table contains just 1 row only and I am just to avoid the ridpool failue by makng a indexable predicate but htis contains just 1 row only. Is there any way one can aoid ridpool getting failed ?
Reply With Quote
  #4 (permalink)  
Old 09-03-09, 09:34
rdutton rdutton is offline
Registered User
 
Join Date: Dec 2008
Posts: 76
Do it for concurrency. Index locks don't usually cause timeouts or deadlocks, row and table locks do.
__________________
RD

Last edited by rdutton; 09-03-09 at 09:44.
Reply With Quote
  #5 (permalink)  
Old 09-03-09, 09:34
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
I haven't tried it myself, but according to what I saw Scott Haas reported you might get a benefit.

Why not create an index and see what happens. It should take less time then to respond to this

Please do let us know what you have found
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #6 (permalink)  
Old 09-03-09, 11:58
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
sahana, maybe it is just me but what are you using a 1 column, 1 row table for? Have you considered using SYSIBM.SYSDUMMY1 instead if you just need a table to query with (such as when doing Date arithmetic)?
Reply With Quote
  #7 (permalink)  
Old 09-03-09, 14:40
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Quote:
Originally Posted by Cougar8000
...according to what I saw Scott Haas reported you might get a benefit.
Alex, May I ask who Scott Haas is?
Reply With Quote
  #8 (permalink)  
Old 09-03-09, 15:07
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by db2girl
Alex, May I ask who Scott Haas is?
I think he means Scott Hayes of DBI.

Andy
Reply With Quote
  #9 (permalink)  
Old 09-03-09, 15:26
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Thank you Andy.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #10 (permalink)  
Old 09-03-09, 17:04
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Maybe I am missing something, but I don't see how DB2 would choose to use an index on a table with one row (unless you altered the cardinality to volatile, or plugged your own numbers in the stats).
__________________
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
  #11 (permalink)  
Old 09-04-09, 11:15
rdutton rdutton is offline
Registered User
 
Join Date: Dec 2008
Posts: 76
It probably wouldn't - the initial post just said it was a one column table, not a one column/one row table.

Although I have seen LUW use an index with cardinality so low that zOS definitely wouldn't.
__________________
RD
Reply With Quote
  #12 (permalink)  
Old 09-04-09, 14:27
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
Roger,
What exactly are you after here? Trying to speed up a query? Just research? If it is for a particular query, let us see the SQL, we may be able to offer up some more helpful advice, as was mentioned using sysdummy1 and other items as well.
Dave
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