IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Would the performance of an update/delete query be the same


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pravin madoori

New User


Joined: 29 Jan 2007
Posts: 25
Location: Hyderabad

PostPosted: Fri Aug 01, 2008 10:42 am
Reply with quote

Would the performance of an update/delete query be the same when primary key is used & when index is used.

I know primary key is also an index however it's an unique index.So if i have below 2 queries, would there be any performance difference with respect to query execution.

1. Update table
set column = :value
where primary key = xxxxxxx;

1. Update table
set column = :value
where index= xxxxxxx;

Thanks in advance
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 01, 2008 11:06 am
Reply with quote

Should be a FORUM Rule: No discussion over query's without an EXPLAIN.

only the OP knows his environment; stop wasting our time making us guess.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Aug 01, 2008 1:13 pm
Reply with quote

the way You posed it, Your question does not make any sense

the where clause must specify a column name

Code:
select ......
where column_name = some_value


"primary key" and "index" do not look like column names to me

running an explain will tell You more
Back to top
View user's profile Send private message
nabarundas

New User


Joined: 21 Jun 2007
Posts: 28
Location: pune

PostPosted: Fri Aug 01, 2008 3:45 pm
Reply with quote

Hi proven madoori,

Could you plz tell me how you get the value of index and how you can use it in where clause? The index is an ordered set of pointers that refer to one or more key columns in a base table. By using the Primary key of table DB2 makes an INDEX(unique) for faster access.

As Dick & Enrico suggested plz reform your question clearly.


Regards,
Nabarun
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Fri Aug 01, 2008 6:18 pm
Reply with quote

No one can guess the SQL performance and its unpredictable.!!.

Explain is the only way. We are not more intelligent than EXPLAIN.
Back to top
View user's profile Send private message
rpuhlman

New User


Joined: 11 Jun 2007
Posts: 80
Location: Columbus, Ohio

PostPosted: Fri Aug 01, 2008 7:06 pm
Reply with quote

FWIW, I believe Pravin is substituting Primary and Index instead of the actual column names to stress his point and help differentiate his examples.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 01, 2008 11:22 pm
Reply with quote

Hello,

Probably a mistake, but i'm going to establish that there is only one matching value for the "other key".

If this is the case, i believe then the queston is: "Will access by the primary key be better, worse, or the same as access by the "other key?".

As far as i know, the access would be the same.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts How to delete a user's alias from the... JCL & VSAM 11
Search our Forums:

Back to Top