473,382 Members | 1,373 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,382 software developers and data experts.

Forcing an HJOIN

Friends:

Please indulge my flurry of postings lately.

I've been struggling with a problem for weeks: Within an SP, I'm self-
joining a table three times (self-join 1 UNION self-join 2 UNION self-
join 3), on different criteria in each case (in lieu of doing a single
self-join on complex OR predicates).

The optimizer insists on doing a MSJOIN for each of the three joins,
which is proving disastrous, execution-wise. The execution flow for
each is SORT leg 1, SORT leg 2 then MSJOIN. The optimizer always
insists on re-sorting the data, i.e., having to do that never seems to
discourage it from using an MSJION and use an HJOIN instead. I want it
to use the latter operator (HSJOIN) instead, though, as when it does,
performance is stellar.

I'm on 8.2 FixPak 10, and may be bumping up against APAR IY78984.
Upgrading to a later FixPak is not an option.

Note that the self-joined table is a DGTT. Further, I always get the
MSJOINs after running statistics on the DGTT. Perversely, If I run no
statistics after populating the DGTT, I almost always get HJOINs and
hence the better performance. Incidentally, I spent the better part of
a day investigating column-group statistics to no avail.

As you can imagine "almost always" getting HJOINs isn't going to work,
as that means the SP will only "almost always" work.

As we don't have optimizer hints to work with, anyone have any ideas
of how I can force the optimizer to always use an HJOIN?

Thanks,

--Jeff

Oct 11 '07 #1
5 3495
jefftyzzer wrote:
As we don't have optimizer hints to work with, anyone have any ideas
of how I can force the optimizer to always use an HJOIN?
http://www.ibm.com/developerworks/db...hen/index.html
Oh you are on V8.1 FP9 ?
http://publib.boulder.ibm.com/infoce...n/r0012554.htm

Do the math...

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Oct 12 '07 #2
On Oct 11, 7:37 pm, Serge Rielau <srie...@ca.ibm.comwrote:
jefftyzzer wrote:
As we don't have optimizer hints to work with, anyone have any ideas
of how I can force the optimizer to always use an HJOIN?

http://www.ibm.com/developerworks/db...le/dm-0612chen...
Oh you are on V8.1 FP9 ?http://publib.boulder.ibm.com/infoce...x.jsp?topic=/c...

Do the math...

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks for your reply, Serge, but I'm afraid there's a subtlety here
that I'm missing.

In your *second* link (since we're on v8 FP 10), you refer to
REG_LIST_VARIABLES. Are you saying that there's an env var I'm
overlooking, or are you suggesting I take a cue from the *first* link
and give optimization profiles a try? The article is written for V9,
but its author says the functionality was introduced in In v8 FP9, or,
lastly, are you suggesting I drop the optimization level to, e.g., 2.

You know, I was re-reading the APAR I mention above, and it says that
the issue doesn't arise when the MSJOIN is a self-join. Mine is, so
perhaps it's not that bug I'm bumping-up against (but it sure seems
like it though: bad plan...joining on character columns...incorrect
cardinality estimates).

As another aside, I'm not sure if I should look to resolving this by
trying to get the MSJOIN to work correctly or by going down the path
I'm on presently and trying to always get an HJOIN. Any pointers on
that?

Thanks,

--Jeff

Oct 12 '07 #3
On Oct 11, 7:37 pm, Serge Rielau <srie...@ca.ibm.comwrote:
jefftyzzer wrote:
As we don't have optimizer hints to work with, anyone have any ideas
of how I can force the optimizer to always use an HJOIN?

http://www.ibm.com/developerworks/db...le/dm-0612chen...
Oh you are on V8.1 FP9 ?http://publib.boulder.ibm.com/infoce...x.jsp?topic=/c...

Do the math...

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks for your reply, Serge, but I'm afraid there's a subtlety here
that I'm missing.

In your *second* link (since we're on v8 FP 10), you refer to
REG_LIST_VARIABLES. Are you saying that there's an env var I'm
overlooking, or are you suggesting I take a cue from the *first* link
and give optimization profiles a try? The article is written for V9,
but its author says the functionality was introduced in In v8 FP9, or,
lastly, are you suggesting I drop the optimization level to, e.g., 2.

You know, I was re-reading the APAR I mention above, and it says that
the issue doesn't arise when the MSJOIN is a self-join. Mine is, so
perhaps it's not that bug I'm bumping-up against (but it sure seems
like it though: bad plan...joining on character columns...incorrect
cardinality estimates).

As another aside, I'm not sure if I should look to resolving this by
trying to get the MSJOIN to work correctly or by going down the path
I'm on presently and trying to always get an HJOIN. Any pointers on
that?

Thanks,

--Jeff

Oct 12 '07 #4
On Oct 11, 7:37 pm, Serge Rielau <srie...@ca.ibm.comwrote:
jefftyzzer wrote:
As we don't have optimizer hints to work with, anyone have any ideas
of how I can force the optimizer to always use an HJOIN?

http://www.ibm.com/developerworks/db...le/dm-0612chen...
Oh you are on V8.1 FP9 ?http://publib.boulder.ibm.com/infoce...x.jsp?topic=/c...

Do the math...

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks for your reply, Serge, but I'm afraid there's a subtlety here
that I'm missing.

In your *second* link (since we're on v8 FP 10), you refer to
REG_LIST_VARIABLES. Are you saying that there's an env var I'm
overlooking, or are you suggesting I take a cue from the *first* link
and give optimization profiles a try? The article is written for V9,
but its author says the functionality was introduced in In v8 FP9, or,
lastly, are you suggesting I drop the optimization level to, e.g., 2.

You know, I was re-reading the APAR I mention above, and it says that
the issue doesn't arise when the MSJOIN is a self-join. Mine is, so
perhaps it's not that bug I'm bumping-up against (but it sure seems
like it though: bad plan...joining on character columns...incorrect
cardinality estimates).

As another aside, I'm not sure if I should look to resolving this by
trying to get the MSJOIN to work correctly or by going down the path
I'm on presently and trying to always get an HJOIN. Any pointers on
that?

Thanks,

--Jeff

Oct 12 '07 #5
jefftyzzer wrote:
On Oct 11, 7:37 pm, Serge Rielau <srie...@ca.ibm.comwrote:
>jefftyzzer wrote:
>>As we don't have optimizer hints to work with, anyone have any ideas
of how I can force the optimizer to always use an HJOIN?
http://www.ibm.com/developerworks/db...le/dm-0612chen...
Oh you are on V8.1 FP9 ?http://publib.boulder.ibm.com/infoce...x.jsp?topic=/c...

Do the math...

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Thanks for your reply, Serge, but I'm afraid there's a subtlety here
that I'm missing.

In your *second* link (since we're on v8 FP 10), you refer to
I didn't see the reference to DB2 V8.1 FP9 when I posted.
The intent was to show that DB2_OPTPROFILE=yes is available.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Oct 12 '07 #6

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

Similar topics

0
by: Hugh Lutley | last post by:
I'm trying to install the Device::SerialPort module using CPAN but whilst CPAN is running 'make test' a couple of errors are flagging so I cannot continue the install without forcing it. I'm not...
12
by: Ritz, Bruno | last post by:
hi in java i found that when a method has a throws clause in the definition, callers must either handle the exceptions thrown by the method they are calling or "forward" the exception to the...
2
by: petev | last post by:
Hello, can anyone help me out?? Maybe its a bit complicated, maybe not :) I'll try to explain. Am not a programmer so have patience! I have a website whose url looks like this:...
1
by: John M | last post by:
Hello All, The code below is something I have been working on and just can't get past. I know it must be very simple but here goes. The Form Method line text is invisible on browers, but still...
6
by: Finn Newick | last post by:
By defining a style as follows: @media aural, handheld {td.layout {display:block;}} I'm hoping to linearise layout tables when viewed by screenreaders and handheld devices (it is also be in...
0
by: Robert Wille | last post by:
I have a number of very common queries that the optimizer plans a very inefficient plan for. I am using postgres 7.2.3. I vacuum hourly. I'm wonderingwhat I can do to make the queries faster. Here...
1
by: Robert Wille | last post by:
I have a number of very common queries that the optimizer plans a very inefficient plan for. I am using postgres 7.2.3. I vacuum hourly. I'm wonderingwhat I can do to make the queries faster. Here...
40
by: Neo The One | last post by:
I think C# is forcing us to write more code by enforcing a rule that can be summarized as 'A local variable must be assgined *explicitly* before reading its value.' If you are interested in what...
4
by: ATS16805 | last post by:
Hi. I wonder if it's possible to "force" a browser to "switch to SSR mode" for any given document. Specifically, I'm looking for a solution, not to a User Agent issue (i think), but a coding idea;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.