Unix Technical Forum

composite keys and delete performance

This is a discussion on composite keys and delete performance within the DB2 forums, part of the Database Server Software category; --> Hi All, I am about to make some changes to a process we have. The new process will have ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-28-2008, 04:39 AM
lfhenry
 
Posts: n/a
Default composite keys and delete performance

Hi All,
I am about to make some changes to a process we have. The new process
will have a new table who's job it is to store temporarily data such
as customer, clerkno,productno, storeno , amount, time.

On a new request from a front-end i will select against the primary
keys to ensure no other request for the same data has been made. This
is then sent to a backend system asynchronously if there is no match.
I will otherwise send a reject msg back to the store if i have the
same data in the table.

On the reply from the backend, i delete this record.
Now this table will hardly ever be filled as messages will be stored
and deleted within a second.

My question is, should i create this table with a single primary key
such as a sequence number or should it be a composite key of say
(customer, clerkno,productno, storeno).
I ask because, i am reluctant to have composite if the database is
maintaining indexes against each primary key column. I.e. four indexes
will have be be maintained for each insert or delete.

Should i just go with a single column sequence pk and then i just
index my customer column for a more restrictive select statement. Any
suggestions?

Thanks,

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-28-2008, 04:39 AM
Mark A
 
Posts: n/a
Default Re: composite keys and delete performance

"lfhenry" <lfhenry@gmail.com> wrote in message
news:c586846f-c0e7-487c-a789-ab88807d4c10@8g2000hsu.googlegroups.com...
> Hi All,
> I am about to make some changes to a process we have. The new process
> will have a new table who's job it is to store temporarily data such
> as customer, clerkno,productno, storeno , amount, time.
>
> On a new request from a front-end i will select against the primary
> keys to ensure no other request for the same data has been made. This
> is then sent to a backend system asynchronously if there is no match.
> I will otherwise send a reject msg back to the store if i have the
> same data in the table.
>
> On the reply from the backend, i delete this record.
> Now this table will hardly ever be filled as messages will be stored
> and deleted within a second.
>
> My question is, should i create this table with a single primary key
> such as a sequence number or should it be a composite key of say
> (customer, clerkno,productno, storeno).
> I ask because, i am reluctant to have composite if the database is
> maintaining indexes against each primary key column. I.e. four indexes
> will have be be maintained for each insert or delete.
>
> Should i just go with a single column sequence pk and then i just
> index my customer column for a more restrictive select statement. Any
> suggestions?
>
> Thanks,


If you a composite primary key of (customer, clerkno,productno, storeno) DB2
will only create one index for this.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-28-2008, 04:39 AM
lfhenry
 
Posts: n/a
Default Re: composite keys and delete performance

On Mar 22, 12:17*pm, "Mark A" <nob...@nowhere.com> wrote:
> "lfhenry" <lfhe...@gmail.com> wrote in message
>
> news:c586846f-c0e7-487c-a789-ab88807d4c10@8g2000hsu.googlegroups.com...
>
>
>
>
>
> > Hi All,
> > I am about to make some changes to a process we have. The new process
> > will have a new table who's job it is to store temporarily data such
> > as customer, clerkno,productno, storeno , amount, time.

>
> > On a new request from a front-end i will select against the primary
> > keys to ensure no other request for the same data has been made. This
> > is then sent to a backend system asynchronously if there is no match.
> > I will otherwise send a reject msg back to the store if i have the
> > same data in the table.

>
> > On the reply from the backend, i delete this record.
> > Now this table will hardly ever be filled as messages will be stored
> > and deleted within a second.

>
> > My question is, should i create this table with a single primary key
> > such as a sequence number or should it be a composite key of say
> > (customer, clerkno,productno, storeno).
> > I ask because, i am reluctant to have composite if the database is
> > maintaining indexes against each primary key column. I.e. four indexes
> > will have be be maintained for each insert or delete.

>
> > Should i just go with a single column sequence pk and then i just
> > index my customer column for a more restrictive select statement. Any
> > suggestions?

>
> > Thanks,

>
> If you a composite primary key of (customer, clerkno,productno, storeno) DB2
> will only create one index for this.- Hide quoted text -
>
> - Show quoted text -


Great, composite key it is.
Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:14 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com