|
|
|
|
|
|
| Author |
Message |
Vincent M *nix forums Guru
Joined: 22 Feb 2005
Posts: 1332
|
Posted: Mon Feb 14, 2005 2:42 pm Post subject:
Re: What is the difference in the update statements?
|
|
|
"Serge Rielau" <srielau@ca.ibm.com> wrote in message
news:37burnF57ctuiU1@individual.net...
| Quote: | Thiru wrote:
Hi,
If performance is not at an issue, then what is the need to have
two different statement??
Thiru.
WantedToBeDBA.
The DB2 optimizer, among other things it does, is to perform query |
optimization during which it converts your syntax to the most efficient DB2
syntax which is functionally equivalent to what you wrote.
You can see the optimized SQL when you do an explain. |
|
| Back to top |
|
 |
Serge Rielau *nix forums Guru
Joined: 29 Apr 2005
Posts: 1583
|
Posted: Mon Feb 14, 2005 2:36 pm Post subject:
Re: What is the difference in the update statements?
|
|
|
Thiru wrote:
| Quote: | Hi,
If performance is not at an issue, then what is the need to have
two different statement??
Thiru.
WantedToBeDBA.
Point for row assignment |
SET (x, y, z) = (SELECT SUM(a), AVG(b), MIN(c) FROM T)
Point for column assignment:
SET x = (SELECT a FROM T1),
y = (SELECT b FROM T2),
z = (SELECT c FROM T3)
Beyond that.. freedom of choice. Whatever you like netter.
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab |
|
| Back to top |
|
 |
Knut Stolze *nix forums Guru
Joined: 28 Jul 2005
Posts: 755
|
Posted: Mon Feb 14, 2005 8:30 am Post subject:
Re: What is the difference in the update statements?
|
|
|
Thiru wrote:
| Quote: | Hi,
If performance is not at an issue, then what is the need to have
two different statement??
|
Some people like the first better than the second.
Similarly you could ask why subqueries are allowed in all situations, given
that you can write many queries using joins, or why BETWEEN exists, which
can be handled with two comparisons.
--
Knut Stolze
Information Integration
IBM Germany / University of Jena |
|
| Back to top |
|
 |
Thiru *nix forums addict
Joined: 20 May 2005
Posts: 80
|
Posted: Mon Feb 14, 2005 7:27 am Post subject:
Re: What is the difference in the update statements?
|
|
|
Hi,
If performance is not at an issue, then what is the need to have
two different statement??
Thiru.
WantedToBeDBA. |
|
| Back to top |
|
 |
Vincent M *nix forums Guru
Joined: 22 Feb 2005
Posts: 1332
|
Posted: Mon Feb 14, 2005 6:59 am Post subject:
Re: What is the difference in the update statements?
|
|
|
"Thiru" <WantedToBeDBA@gmail.com> wrote in message
news:1108366818.298286.90460@z14g2000cwz.googlegroups.com...
| Quote: | Hi all,
Here are the two update statement.
UPDATE stock SET status=NULL, quantity=0, price=0 WHERE type <> 'S'
UPDATE stock SET (status, quantity, price) = (NULL, 0, 0) WHERE type
'S'
What is the difference between the above 2 update statement? Which
statement will yield good performance?
Thanks,
Thiru.
WantedToBeDBA.
No difference in performance. |
The performance will depend on a number of factors such as:
1. Is there an index on TYPE?
2. Cardinality of rows not = 'S' and size of the rows.
3. Is table clustered on TYPE? |
|
| Back to top |
|
 |
Thiru *nix forums addict
Joined: 20 May 2005
Posts: 80
|
Posted: Mon Feb 14, 2005 6:40 am Post subject:
What is the difference in the update statements?
|
|
|
Hi all,
Here are the two update statement.
UPDATE stock SET status=NULL, quantity=0, price=0 WHERE type <> 'S'
UPDATE stock SET (status, quantity, price) = (NULL, 0, 0) WHERE type
<> 'S'
What is the difference between the above 2 update statement? Which
statement will yield good performance?
Thanks,
Thiru.
WantedToBeDBA. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 2:39 am | All times are GMT
|
|
Mortgages | Mobile Phones | Credit Cards | Credit Counseling | Sailor Moon Music
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|