Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10327
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Delete IMS remote transaction when MO... Sam Singh IMS DB/DC 0 Wed Aug 23, 2017 9:12 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us