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

choice of clustering index


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

Active User


Joined: 31 Oct 2006
Posts: 131
Location: brisbane

PostPosted: Tue Feb 09, 2021 8:17 am
Reply with quote

I have a table T that I want to index on a date column (ASC) + Instance ID (ASC) to support the primary workload.

The date values will *mostly* be received in ascending order, however we need to allow that some (up to 5 %) will be out of order, by as much as one week.

So, a representative sample might look like:

Code:

Received on      Date value          count(*)         Instance Id allocated

1/1/21           1/1/21              1000             1 to 1000
2/1/21           2/1/21              1200             1001 to 2200
3/1/21           3/1/21              800              2201 to 3000
3/1/21           28/12/20            6                3001 to 3006
4/1/21           4/1/21              900              3007 to 3906



My question is whether a single clustered index on Date + Instance ID would be sufficient - or - to cater for the number of out-of-sequence date values , should I have Date + Instance ID as non-clustered, and add a clustered index on , say, Month(Date column) - assuming this is supported in db2 ?

so:

option A :

clustered index on Date-col ASC + instance ID ASC


option B :

non clustered index on Date-col ASC + instance ID ASC
clustered index on Month(date-col)

or ?
Option C :

non clustered index on Date-col ASC + instance ID ASC
clustered index on date-column



I expect table T to grow quickly and into the millions. No Update operations on the Date column allowed. Also, (at this stage), no physical deletes allowed
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Tue Feb 09, 2021 8:34 am
Reply with quote

If you are not a DBA then please talk to your site DBA.
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Thu Feb 11, 2021 5:18 pm
Reply with quote

Hey There,

How data is going to be fetched from this table?
Back to top
View user's profile Send private message
jzhardy

Active User


Joined: 31 Oct 2006
Posts: 131
Location: brisbane

PostPosted: Mon Feb 15, 2021 2:20 am
Reply with quote

fetch order is Date DESC, Instance ID DESC
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 Cobol file using index COBOL Programming 2
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts Add column to existing records using ... JCL & VSAM 2
No new posts Secondary index error while loading d... IMS DB/DC 2
No new posts Issue in KWIKKEY utility while creat... JCL & VSAM 2
Search our Forums:

Back to Top