View previous topic :: View next topic
|
Author |
Message |
pravin madoori
New User
Joined: 29 Jan 2007 Posts: 25 Location: Hyderabad
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
nabarundas
New User
Joined: 21 Jun 2007 Posts: 28 Location: pune
|
|
|
|
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 |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
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 |
|
|
rpuhlman
New User
Joined: 11 Jun 2007 Posts: 80 Location: Columbus, Ohio
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|