473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Date roll over functionality

Hello All,

I am very new to DB2. I am studying the feasibility of porting my
appliction to DB2.

Our appliction keeps 45 days of data. the data for the 46th day is to
be purged.

Currently we have created fragmentation of the table based on date.
every day we drop the fragment of 46th day.

Can someone advice me how will I create the same kind of fragmentation
logic on db2. Or some other efficient way of purging data for the 46th
day?

Also, can I create data fragements based on two fields? So that I have
fragments o n on field called status (which is used as a criteria in
most sql queries) and date (used for data purging)?

thanks for your help and patience.

regards,
Abhishek.
Nov 12 '05 #1
5 2655
Have a look at MDC (Multi-dimensional clustering) in the manuals.
Another approach is to use free space options, and alter them to keep
the data clustered on disk. That approach is discussed briefly here:

http://www-106.ibm.com/developerwork..._adamache.html

Abhishek Srivastava wrote:
Hello All,

I am very new to DB2. I am studying the feasibility of porting my
appliction to DB2.

Our appliction keeps 45 days of data. the data for the 46th day is to
be purged.

Currently we have created fragmentation of the table based on date.
every day we drop the fragment of 46th day.

Can someone advice me how will I create the same kind of fragmentation
logic on db2. Or some other efficient way of purging data for the 46th
day?

Also, can I create data fragements based on two fields? So that I have
fragments o n on field called status (which is used as a criteria in
most sql queries) and date (used for data purging)?

thanks for your help and patience.

regards,
Abhishek.


Nov 12 '05 #2
You can use a partitioning view using UNION ALL.
Each base table holds 1 day.
I woudl propose using an integer presentation for the date column (not
null!) then add a check constraint for each table forcing the day.
You can insert, update and select from teh view. If you did it right the
plans will look very much like a normal select from any base table.
Performance impact will be minimal.
To roll-out data:
ALTER TABLE <basetabx> DROP CONSTRAINT chkdatex;
ALTER TABLE <basetabx> ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE;
ALTER TABLE <basetabx> ADD CONSTRAINT chkdatex CHECK (date = 20031209);
commit;

done :-)
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #3
The UNION ALL method is described here:

http://www7b.boulder.ibm.com/dmdd/li...202zuzarte.pdf

Serge Rielau wrote:
You can use a partitioning view using UNION ALL.
Each base table holds 1 day.
I woudl propose using an integer presentation for the date column (not
null!) then add a check constraint for each table forcing the day.
You can insert, update and select from teh view. If you did it right the
plans will look very much like a normal select from any base table.
Performance impact will be minimal.
To roll-out data:
ALTER TABLE <basetabx> DROP CONSTRAINT chkdatex;
ALTER TABLE <basetabx> ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE;
ALTER TABLE <basetabx> ADD CONSTRAINT chkdatex CHECK (date = 20031209);
commit;

done :-)


Nov 12 '05 #4
... and in the full disclosure report of the TPC-C result. So we know for
fact that it flies.
In terms of performance it is well within the range of what you'd expect
from true range partitioning as known in Informix or DB2 z/OS.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #5
Serge Rielau wrote:
.. and in the full disclosure report of the TPC-C result.


Funny - I didn't know the TPC-C required archiving of the 46th day of
data or any other date roll over type functionality ?

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
5
by: goochey | last post by:
I'm trying to convert a Julian Date (Format "4365") into an actual calendar date in Visual Basic, can anyone help me out with this.
26
by: sgershon | last post by:
Hi. I know this is should be a simple question. I know server-side web-programming, and never needed to use client-side scripting... until now :) I have done so far a little number of scripts...
3
by: rhaley | last post by:
ugh. Okay, I need to figure out the number of milliseconds between DateTime.Now and the end of the day so that I can make changes based on the date roll-over. I need to implement a Timer so that I...
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
11
by: Mike9900 | last post by:
How can I get the real system date/time if the user fakes the date, for example by setting the system date back. -- Mike
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
0
by: botenremko | last post by:
Hi all! I am searching for a css or javascript with which I can perform the roll-over-and-click-to-hold functionality as can be seen in the main navigation menu of www.watersport-bank.nl. ...
2
by: umeshkakade | last post by:
I have used mdb with 4 fields - rollno, name, date & attendance. I have design a form for data entry by considering above fields. I have connected it to DAO database object. Suppose I have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.