473,624 Members | 2,026 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 1680
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_TI ME) / 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_TI ME) / 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_T IME) / 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_T IME) / 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 generic design patterns that can be used and shared amongst many sub-schemas. For example, the grouping of entities. I may have the following tables: employee, product and client. These tables have no direct relationship with each other. But...
9
2921
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 a device. The definition of the table is as follows: CREATE TABLE devicedata ( device_id int NOT NULL REFERENCES devices(id), -- id in the device
2
2440
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 experts. I've been asked to create a Daily Log sheet to be distributed to some of our clerks. For each day, the clerk is to log tasks worked on for the day, (i.e worked on the johnson account).
6
2111
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 responsible for instantiating the orders class? Would it be the ui layer or the master class in the business layer? thanks,
17
2690
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 know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
17
4842
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 Page Is Valid XHTML 1.0 Transitional!" but it still wouldn't look the same. It is on http://www.dvdnowkiosks.com/new/theproduct.php scroll down and recognize the black bottom bar when you go ewith firefox(2.0) which isn't there with IE7. Why does...
6
2132
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 times when I program, I will create objects for a specific purpose for a program and if I need to add to it I just add the code.
0
2070
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 end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently structured relational database system. The CMS stores articles. The CMS also stores related items --...
19
3156
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 certification, possibly that involves C++, but, if not, C++ and UML. All I could find was Java + UML design certifications (one such is detailed on http://www.objectsbydesign.com/tools/certification.html). Although UML is expected to be language independent,...
8
2217
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, port number, or both. How should we design the classes to represent these filters? My answer was: class FilterRule {
0
8238
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8174
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7164
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
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 we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.