IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Table Clustering Index


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
djgoer

New User


Joined: 08 Jan 2009
Posts: 7
Location: Philippines

PostPosted: Thu Sep 24, 2009 9:25 am
Reply with quote

Hello,

Is there a way for me to find out what the clustering index is for a particular table? Is there a catalog in which these can be found?

Thanks.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Thu Sep 24, 2009 10:56 am
Reply with quote

Hi,
You can use the catalog manager to find the cluster index, you can even query it to find it out
Back to top
View user's profile Send private message
djgoer

New User


Joined: 08 Jan 2009
Posts: 7
Location: Philippines

PostPosted: Thu Sep 24, 2009 12:00 pm
Reply with quote

I tried to query the SYSCAT catalogs, however I got a SQL -204 error. Any idea as to why I am getting this error code? Does this have anything to do with access?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Sep 24, 2009 12:03 pm
Reply with quote

Quote:
... however I got a SQL -204 error. Any idea as to why I am getting this error code?

do You realize that the manuals are there to answer exactly this type of questions ?

SYSCAT is not a DB2 term
( to be sure I just searched the manuals, and the only 2 occurences of the syscat word were errors
SYSCAT.XSROBJECTS instead of SYSIBM.XSROBJECTS)

anyway the DB2 tables have name of the form "SYSIBM.xxxxxxxxx"
and maybe the table to query is "SYSIBM.SYSINDEXES"
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Thu Sep 24, 2009 12:25 pm
Reply with quote

Can you post the query which you have tired?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Sep 24, 2009 12:33 pm
Reply with quote

Hello Djoger,

You can try below query

Code:
Select CLUSTERING
From SYSIBM.SYSINDEXES
Where NAME ='Index-name'
And CREATOR='owner'


If Query return Y then its a clustering Index otherwise not
Back to top
View user's profile Send private message
djgoer

New User


Joined: 08 Jan 2009
Posts: 7
Location: Philippines

PostPosted: Thu Sep 24, 2009 12:54 pm
Reply with quote

I finally came up with the following query which does seem to work fine:

SELECT COLNAME
FROM SYSIBM.SYSINDEXES A, SYSIBM.SYSKEYS B
WHERE TBNAME = 'table name'
AND CLUSTERING = 'Y'
AND A.NAME = B.IXNAME
WITH UR;


I got confused when reading some of the documentation that mention
SYSCAT catalog views, which is why I tried to query them.

Example of which is:

publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0001063.htm
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Sep 24, 2009 1:00 pm
Reply with quote

Hello Djgoer,

You can try following query as well

Code:
Select Name   
Where TBNAME='OGN_BUS_ETY_AUD'
and TBCREATOR='OWNER'
and CLUSTERING = 'Y'


Would you please clarify the reason for using SYSIBM.SYSKEYS in your query?
Back to top
View user's profile Send private message
djgoer

New User


Joined: 08 Jan 2009
Posts: 7
Location: Philippines

PostPosted: Thu Sep 24, 2009 1:05 pm
Reply with quote

Hello Guptae,

Using SYSIBM.SYSKEYS gives me the Column Name directly, whereas if I don't use it, all I would get is the Index Name.

Thank you all for your help! :-)

Regards.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Sep 24, 2009 1:15 pm
Reply with quote

reason for mentioning SYSCAT is DB2luw (see provided link to publicboulder)
luw = Linux Unix Windows
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top