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 > Use of Partitions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-10-07, 12:57
pineappleman pineappleman is offline
Registered User
 
Join Date: Jan 2007
Posts: 5
Use of Partitions

I have 7 different tables - all same in structure but each one has a check constraint for the day of the week. I have view over all 7 tables, which does a union all over 7 tables. The load process inserts into the "view" and the check constraint directs the data into the correct table as per the check constraint.

Can this be achieved by using one table that is partitioned 7 times so I can get rid of the view and the need for several tables ?
Reply With Quote
  #2 (permalink)  
Old 01-10-07, 13:03
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
If you have DB2 V9.1, then you can use the new range partitioning feature that it has instead of UNION ALL views.

DB2 V8 does have hash partitioning (DPF) but I don't think that is what you want.
__________________
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
  #3 (permalink)  
Old 01-11-07, 04:31
pineappleman pineappleman is offline
Registered User
 
Join Date: Jan 2007
Posts: 5
Marcus - I have been struggling with the syntax for this since yesterday. I am not sure if I am doing this correctly...

PARTITION BY RANGE (DATE)
STARTING DAYOFWEEK(DATE) ENDING DAYOFWEEK(DATE) EVERY 1 DAY

..does not work

i suppose all i want is 7 partitions and with every mondays data going in part 1 etc
Reply With Quote
  #4 (permalink)  
Old 01-11-07, 09:04
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I think you'll need to create a separate column populated with the value of DAYOFWEEK(DATE) and partition by that column.
Reply With Quote
  #5 (permalink)  
Old 01-11-07, 12:26
pineappleman pineappleman is offline
Registered User
 
Join Date: Jan 2007
Posts: 5
Could I attack this a different way ? Just partition by the date, and every 7 days detach the oldest partition?
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