473,499 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MDC Design question

DB2 LUW v8 FP15 Linux.

Consider the table T (ID varchar, FIELD_TIME timestamp, Field3
integer). There are approx. 1k different IDs.

Each minute, one application inserts around (avg. 200, max 5k rows)
for each ID. That makes 200k rows per minute, and 12M rows per hour.

As soon as there is at least 1h of inserted data for each ID, another
application summarizes rows then deletes this 'hour', exploiting
existing indexes (delete from T where ID=? and FIELD_TIME between ?
and ?).

Depending on the number of rows each 'hour' has, I break down the
delete statements with smaller ranges (5min/10min/20min/30min/60min
'chunk').

According to the above scenario, what is a good design for a MDC
table ?
Should I use ID as one dimension, and HOUR(FIELD_TIME) [generated
field] as the other ? This table can be quite big.

Thanks for your inputs.

-M

Nov 13 '07 #1
4 1672
Michel Esber wrote:
DB2 LUW v8 FP15 Linux.

Consider the table T (ID varchar, FIELD_TIME timestamp, Field3
integer). There are approx. 1k different IDs.

Each minute, one application inserts around (avg. 200, max 5k rows)
for each ID. That makes 200k rows per minute, and 12M rows per hour.

As soon as there is at least 1h of inserted data for each ID, another
application summarizes rows then deletes this 'hour', exploiting
existing indexes (delete from T where ID=? and FIELD_TIME between ?
and ?).

Depending on the number of rows each 'hour' has, I break down the
delete statements with smaller ranges (5min/10min/20min/30min/60min
'chunk').

According to the above scenario, what is a good design for a MDC
table ?
Should I use ID as one dimension, and HOUR(FIELD_TIME) [generated
field] as the other ? This table can be quite big.
You want to keep the rollup monotonic:
BIGINT(FIELD_TIME) / 10000 will give you date to the hour

What do you query on?
200 rows per block is pretty sparse. You may end up with a lot of wasted
space.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Nov 13 '07 #2
On 13 nov, 13:47, Serge Rielau <srie...@ca.ibm.comwrote:
Michel Esber wrote:
DB2 LUW v8 FP15 Linux.
Consider the table T (ID varchar, FIELD_TIME timestamp, Field3
integer). There are approx. 1k different IDs.
Each minute, one application inserts around (avg. 200, max 5k rows)
for each ID. That makes 200k rows per minute, and 12M rows per hour.
As soon as there is at least 1h of inserted data for each ID, another
application summarizes rows then deletes this 'hour', exploiting
existing indexes (delete from T where ID=? and FIELD_TIME between ?
and ?).
Depending on the number of rows each 'hour' has, I break down the
delete statements with smaller ranges (5min/10min/20min/30min/60min
'chunk').
According to the above scenario, what is a good design for a MDC
table ?
Should I use ID as one dimension, and HOUR(FIELD_TIME) [generated
field] as the other ? This table can be quite big.

You want to keep the rollup monotonic:
BIGINT(FIELD_TIME) / 10000 will give you date to the hour

What do you query on?
200 rows per block is pretty sparse. You may end up with a lot of wasted
space.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Hi Serge,

Thanks for the quick reply.

My application (C++ stored proc) retrieves all rows that belong to one
ID and one given hour. Example:

select * from T where ID=? and field_time between
'2007-11-13-15.00.00.000000' and '2007-11-13-16.00.00.000000'.

In 1 hour, there can be (200*60 avg, 5k*60 max) rows for each ID.
There are around 500-1k different IDs.

Wasted space is a concern. By the way, this is a OLTP system. Data is
inserted and removed all the time. Is MDC a good approach for this?

Thanks

Nov 13 '07 #3
Michel Esber wrote:
On 13 nov, 13:47, Serge Rielau <srie...@ca.ibm.comwrote:
>Michel Esber wrote:
>>DB2 LUW v8 FP15 Linux.
Consider the table T (ID varchar, FIELD_TIME timestamp, Field3
integer). There are approx. 1k different IDs.
Each minute, one application inserts around (avg. 200, max 5k rows)
for each ID. That makes 200k rows per minute, and 12M rows per hour.
As soon as there is at least 1h of inserted data for each ID, another
application summarizes rows then deletes this 'hour', exploiting
existing indexes (delete from T where ID=? and FIELD_TIME between ?
and ?).
Depending on the number of rows each 'hour' has, I break down the
delete statements with smaller ranges (5min/10min/20min/30min/60min
'chunk').
According to the above scenario, what is a good design for a MDC
table ?
Should I use ID as one dimension, and HOUR(FIELD_TIME) [generated
field] as the other ? This table can be quite big.
You want to keep the rollup monotonic:
BIGINT(FIELD_TIME) / 10000 will give you date to the hour

What do you query on?
200 rows per block is pretty sparse. You may end up with a lot of wasted
space.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Hi Serge,

Thanks for the quick reply.

My application (C++ stored proc) retrieves all rows that belong to one
ID and one given hour. Example:

select * from T where ID=? and field_time between
'2007-11-13-15.00.00.000000' and '2007-11-13-16.00.00.000000'.

In 1 hour, there can be (200*60 avg, 5k*60 max) rows for each ID.
There are around 500-1k different IDs.

Wasted space is a concern. By the way, this is a OLTP system. Data is
inserted and removed all the time. Is MDC a good approach for this?
Yes, I may not follow the mainstream here, but I think MDC is good for
OLTP despite having been provided for warehousing.

So you have and average of 12000 rows per MDC "square". With 300000 max.
How many rows per page? From there you can pick your block size. The
trick is to make sure that your near empty squares don't chew up too
much memory.
I think it's feasible to do (id, BIGINT(time)/10000).

There is an MDC advisor btw.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Nov 13 '07 #4
Ian
Michel Esber wrote:
On 13 nov, 13:47, Serge Rielau <srie...@ca.ibm.comwrote:
>Michel Esber wrote:
>>DB2 LUW v8 FP15 Linux.
Consider the table T (ID varchar, FIELD_TIME timestamp, Field3
integer). There are approx. 1k different IDs.
Each minute, one application inserts around (avg. 200, max 5k rows)
for each ID. That makes 200k rows per minute, and 12M rows per hour.
As soon as there is at least 1h of inserted data for each ID, another
application summarizes rows then deletes this 'hour', exploiting
existing indexes (delete from T where ID=? and FIELD_TIME between ?
and ?).
Depending on the number of rows each 'hour' has, I break down the
delete statements with smaller ranges (5min/10min/20min/30min/60min
'chunk').
According to the above scenario, what is a good design for a MDC
table ?
Should I use ID as one dimension, and HOUR(FIELD_TIME) [generated
field] as the other ? This table can be quite big.
You want to keep the rollup monotonic:
BIGINT(FIELD_TIME) / 10000 will give you date to the hour

What do you query on?
200 rows per block is pretty sparse. You may end up with a lot of wasted
space.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab


Hi Serge,

Thanks for the quick reply.

My application (C++ stored proc) retrieves all rows that belong to one
ID and one given hour. Example:

select * from T where ID=? and field_time between
'2007-11-13-15.00.00.000000' and '2007-11-13-16.00.00.000000'.

In 1 hour, there can be (200*60 avg, 5k*60 max) rows for each ID.
There are around 500-1k different IDs.

Wasted space is a concern. By the way, this is a OLTP system. Data is
inserted and removed all the time. Is MDC a good approach for this?
Based on the limited information you've provided, MDC sounds like
a reasonable approach for this, because it can really help by
eliminating the requirement to reorg on a regular basis. Plus, a
block index for the TIME column may be more efficient.

Just make sure that extentsize for the tablespace is small enough that
you don't waste space as Serge suggested.

Also look into the DB2_MDC_ROLLOUT registry variable.

One other warning: There is an open APAR (LI72585) for the query
rewrite code that prevents DB2 from automatically adding predicates
against the generated column when the source column is a timestamp.
You might run into this, so check your explain plans.
Nov 13 '07 #5

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

Similar topics

5
674
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
9
2912
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
2
2424
by: Test User | last post by:
Hi all, (please excuse the crosspost as I'm trying to reach as many people as possible) I am somewhat familiar with Access 2000, but my latest project has me stumped. So, I defer to you...
6
2103
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is...
17
2668
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
17
4824
by: roN | last post by:
Hi, I'm creating a Website with divs and i do have some troubles, to make it looking the same way in Firefox and IE (tested with IE7). I checked it with the e3c validator and it says: " This...
6
2120
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often...
0
2064
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
19
3133
by: neelsmail | last post by:
Hi, I have been working on C++ for some time now, and I think I have a flair for design (which just might be only my imagination over- stretched.. :) ). So, I tried to find a design...
8
2205
by: indrawati.yahya | last post by:
In a recent job interview, the interviewer asked me how I'd design classes for the following problem: let's consider a hypothetical firewall, which filters network packets by either IP address,...
0
7128
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7006
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...
0
7169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.