Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Would the performance of an update/delete query be the same
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: 6968
Location: porcelain throne

PostPosted: Fri Aug 01, 2008 11:06 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10276
Location: italy

PostPosted: Fri Aug 01, 2008 1:13 pm    Post subject: Reply to: Would the performance of an update/delete query b
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    Post subject: plz reform your question clearly
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Aug 01, 2008 11:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CONTIG for performance? JPVRoff JCL & VSAM 7 Fri Jun 09, 2017 8:39 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us