473,549 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Long compiling of SQL statements

Hi!

I have a problem on one of my databases.
I have a Java application that issues SQL statements to that database.
Some of the SQL statements make DB2 go to into a compile state for hours.
I see Compiling if I do "db2 list applications show detail".

How can I see what is causing this behaviour ? What do to ?

Best regards,
Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac | Gr**********@mi kropis.si |
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Feb 21 '06 #1
5 4823
Gregor KovaÄŤ wrote:
Hi!

I have a problem on one of my databases.
I have a Java application that issues SQL statements to that database.
Some of the SQL statements make DB2 go to into a compile state for hours.
I see Compiling if I do "db2 list applications show detail".

How can I see what is causing this behaviour ? What do to ?

Best regards,
Kovi

Is this complex SQL? What's your optimization level?
Note that for OLTP the recommended level is 3.
For BI typically 5 or 7. 9 should only ever be used ad-hoc for experiments.
What does the package cache information say? Are there overflows?

In a well behaved system the package cache should have a very near 100%
hit ratio with a stable number of "package cache inserts". If that's not
teh case you have soemone firing queries without using parameter markers
or yoru cache is too small (thrashing).

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Feb 21 '06 #2
Serge Rielau wrote:
Gregor Kovač wrote:
Hi!

I have a problem on one of my databases.
I have a Java application that issues SQL statements to that database.
Some of the SQL statements make DB2 go to into a compile state for hours.
I see Compiling if I do "db2 list applications show detail".

How can I see what is causing this behaviour ? What do to ?

Best regards,
Kovi

Is this complex SQL? What's your optimization level?
Note that for OLTP the recommended level is 3.
For BI typically 5 or 7. 9 should only ever be used ad-hoc for
experiments. What does the package cache information say? Are there
overflows?

In a well behaved system the package cache should have a very near 100%
hit ratio with a stable number of "package cache inserts". If that's not
teh case you have soemone firing queries without using parameter markers
or yoru cache is too small (thrashing).

Cheers
Serge

Our application if OLTP and I always use default optimization level.
None of the SQLs is complex, just couple of JOINs and that's it.
If I do "select * from table(snapshot_ database(cast(N ULL as varchar(1)),-1))
as f" I see that there are about 0.6 % of sort overflows, 5 catalog cache
overflows out of over 200000 lookups, 0 hash join overflows and 1 package
cache overflow.
In db2diag.log I can see some lock escalations, but I know what those are
there for, and the tables involved in lock escalation don't have anything
to do with SQLs that are compiling.
The only difference that I can see is that we have an online backup to TSM
and the logs are being archived.

Hmm...

Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac | Gr**********@mi kropis.si |
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Feb 21 '06 #3
>From my past experience with java stored V8 procedures (dynamic jdbc,
not sqlj) on AIX 5, I noticed the application snapshots sometimes shown
COMPILE state when long running update or insert embedded in java was
indeed executing. Because the procedures were always succeeding with a
result, we didn't bother to call IBM support though. If you own the
java proc's code, to pinpoint that issue, you can use SET EXPLAIN
MODE=EXPLAIN SQL statement in your code and have the SQL statements to
only compile but not execute. Otherwise grab the SQL statements from
your batch using SQL snapshots and try to compile them separately using
any of the DB2 explain facility available features.

Feb 21 '06 #4
>From my past experience with java stored V8 procedures (dynamic jdbc,
not sqlj) on AIX 5, I noticed the application snapshots sometimes shown
COMPILE state when long running update or insert embedded in java was
indeed executing. Because the procedures were always succeeding with a
result, we didn't bother to call IBM support though. If you own the
java proc's code, to pinpoint that issue, you can use SET EXPLAIN
MODE=EXPLAIN SQL statement in your code and have the SQL statements to
only compile but not execute. Otherwise grab the SQL statements from
your batch using SQL snapshots and try to compile them separately using
any of the DB2 explain facility available features.

-Eugene

Feb 21 '06 #5
Eugene F wrote:
From my past experience with java stored V8 procedures (dynamic jdbc,

not sqlj) on AIX 5, I noticed the application snapshots sometimes shown
COMPILE state when long running update or insert embedded in java was
indeed executing. Because the procedures were always succeeding with a
result, we didn't bother to call IBM support though. If you own the
java proc's code, to pinpoint that issue, you can use SET EXPLAIN
MODE=EXPLAIN SQL statement in your code and have the SQL statements to
only compile but not execute. Otherwise grab the SQL statements from
your batch using SQL snapshots and try to compile them separately using
any of the DB2 explain facility available features.

-Eugene


Hi!

We are on Windows 2003 and the SQLs in question are not in a procedure. They
are simple dynamic SQLs that are send from the application.

Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac | Gr**********@mi kropis.si |
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Feb 22 '06 #6

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

Similar topics

1
2910
by: Arnab Nandi | last post by:
public class Test { static int returnValue() throws Exception { while (true) { try { break; } finally { return 1; } } }
2
2621
by: tom horner | last post by:
Any ideas on why drop and create alias statements would take a long time? We recently went through an upgrade of our production database, which included alter statements to table structures, create tables, drop tables, and data inserts, deletes, and updates. Also, we dropped and recreated all the alias's we had on the tables and views to...
4
11331
by: Aaron Queenan | last post by:
When I build a C++ library to .NET using the managed C++ compiler, I get the following error message: Linking... LINK : error LNK2020: unresolved token (0A000005) _CrtDbgReport LINK : error LNK2020: unresolved token (0A000007) memset LINK : error LNK2020: unresolved token (0A000008) free LINK : error LNK2020: unresolved token (0A00000A)...
17
4331
by: Michel Esber | last post by:
Environment: DB2 V7 + FP 14 running Linux. One of my systems is performing poorly. CPU is 100% busy. I activated an Event Monitor and the prepared statements sent by applications are taking very long to execute. I can see a bottleneck during the PREPARE. When the application issues an OPEN, response is quick. When I run a "list...
35
3925
by: aNt17017 | last post by:
This is my code: long fact(int n) { if (n == 0) return(1); if(n > 100) { printf("\t\tERROR: %d is too large for factorial.\n", n); return 1;
8
2190
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the existing code. The options I've considered so far: 1. Create a new MC++ GUI project and add the *.c files to them and mark them with pragma...
9
6412
by: vadivel.ks | last post by:
hi, My code having unsigned long long int64_t; like that.. compile error message is long followed by long is illegal, what is the reason for it?
2
3076
by: Michel Esber | last post by:
Hello DB2 LUW v8 FP15. My Database STMTHEAP parameter is 4096 * 4k pages, so there is plenty of space. IF: a) I use Java's and JCC, I am able to run long statements ( 65K ). b) I use CLP (for example, db2 -tvf long_file_with_statement.sql), I
0
340
by: Troels Arvin | last post by:
Earlier, I wrote: It turns out that the application status flip-flops between "Compiling" and "UOW Executing", with "Compiling" dominating. At some point, status changes to "Commit active". Is the flip-flopping normal for a long-running query? I would assume a sequence of Compiling->Executing->Commit. But perhaps this is not
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7957
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.