473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DB2 "ALL" subquery strategy

Does DB2 process "ALL" subquery by "nested iteration" strategy, or
using its own special algorithm?

For example, assume r(A, B, C) and s(D, E, F) are two relations,
consider the following query:
Q1: select r.*
from r
where r.A> 5 and
r.C > all (select s.D
from s
where r.B = s.E and s.F<10)

We are planning to unnest this query first by performing outer join and
then process the intermediate result by our approach:
Q2: select r1.*, s1.*
from (select r.*
from r
where r.A > 5) r1
left outer join
(select s.*
from s
where s.F<10) s1
on r.B = s.E

If DB2 evaluate query Q1 by "nested iteration" approach, query Q2
should perform faster than Q1.
However, when I ran them in DB2, Q1 is a little bit faster than Q2. So
I think DB2 has its own algorithm to evaluate "ALL" subquery, is it
true?
thanks
Nov 12 '05 #1
1 7328
If you are talking about db2 udb for LUW, you can check the rewirte part
from the output of db2exfmt utility.

"LazyAnt" <so***********@hotmail.com> wrote in message
news:f6**************************@posting.google.c om...
Does DB2 process "ALL" subquery by "nested iteration" strategy, or
using its own special algorithm?

For example, assume r(A, B, C) and s(D, E, F) are two relations,
consider the following query:
Q1: select r.*
from r
where r.A> 5 and
r.C > all (select s.D
from s
where r.B = s.E and s.F<10)

We are planning to unnest this query first by performing outer join and
then process the intermediate result by our approach:
Q2: select r1.*, s1.*
from (select r.*
from r
where r.A > 5) r1
left outer join
(select s.*
from s
where s.F<10) s1
on r.B = s.E

If DB2 evaluate query Q1 by "nested iteration" approach, query Q2
should perform faster than Q1.
However, when I ran them in DB2, Q1 is a little bit faster than Q2. So
I think DB2 has its own algorithm to evaluate "ALL" subquery, is it
true?
thanks

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: KENNY L. CHEN | last post by:
Dear experts, I have two tables in my Oracle 8i database: TEST (COL1,COl2,REC_NO) and TEST1 (COL1,COL2,REC_NO). Both tables are unique-indexed on (COL1,COL2,REC_NO). I think the following...
3
by: Adam Toline | last post by:
In reference to the following: http://www.bellecose.com/form.htm At the top of each column there is a box for "All". When one is checked I need to check all of (and only) those boxes...
4
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
2
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The...
4
by: google | last post by:
Hi Hope someone can help me with this - have been staring at this problem all day, and with the cold I've got, just don't seem to be able to figure it out! I've got two tables, here with some...
2
by: bhdvir | last post by:
Does anybody have any advice on selecting all records within a iif-statement? I have a form in which one has to state if all projects or just a selection of projects are to be used for a query....
2
by: getmeidea | last post by:
Hi all, String x = "\\"; This string will have the value \. Now for any string contains \, i need to replace with \\. But when i use x = x.replaceAll("\\", "\\\\"); I am getting runtime...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.