473,796 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flush package cache for one sql

I've been trying to tune this complex sql that uses the 'exists'
clause. It is damn slow, even though the tables are not big and I have
indexes on the columns in the sql. Currently I am trying MQTs, but
when I was tuning them, I was changing the reopt parameter in the
set_routine_opt s procedure, and also playing with optimization level.
But I couldnt get db2 to give me different answer when I don't flush
package cache!! (eventhough I used reopt always). But since this is a
big db used by many other applications,
I cannot flush the package cache repeatedly. Is there a way to flush
just the sql's execution plan in the memory instead of the whole
thing? I know this is a big ask!!
Feb 5 '08 #1
4 2724
Do you have an explain plan for this query at the different
optimization levels? Are the statistics current for the tables and
indexes used by the query?

Cheers,
On Feb 6, 6:58 am, Arun Srinivasan <arunro...@gmai l.comwrote:
I've been trying to tune this complex sql that uses the 'exists'
clause. It is damn slow, even though the tables are not big and I have
indexes on the columns in the sql. Currently I am trying MQTs, but
when I was tuning them, I was changing the reopt parameter in the
set_routine_opt s procedure, and also playing with optimization level.
But I couldnt get db2 to give me different answer when I don't flush
package cache!! (eventhough I used reopt always). But since this is a
big db used by many other applications,
I cannot flush the package cache repeatedly. Is there a way to flush
just the sql's execution plan in the memory instead of the whole
thing? I know this is a big ask!!
Feb 5 '08 #2
Arun Srinivasan wrote:
I've been trying to tune this complex sql that uses the 'exists'
clause. It is damn slow, even though the tables are not big and I have
indexes on the columns in the sql. Currently I am trying MQTs, but
when I was tuning them, I was changing the reopt parameter in the
set_routine_opt s procedure, and also playing with optimization level.
But I couldnt get db2 to give me different answer when I don't flush
package cache!! (eventhough I used reopt always). But since this is a
big db used by many other applications,
I cannot flush the package cache repeatedly. Is there a way to flush
just the sql's execution plan in the memory instead of the whole
thing? I know this is a big ask!!
There are two ways to invalidate objects in the dyanamic package cache:
Hard invalidation: Shoot something that object needs to live
Soft invalidation: Add/change something that object might like: RUNSTATS

There is no option to purge a specific object from the cache.
Soft invalidation may depend on your version....

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Feb 5 '08 #3
On Feb 5, 11:58 am, Arun Srinivasan <arunro...@gmai l.comwrote:
I've been trying to tune this complex sql that uses the 'exists'
clause. It is damn slow, even though the tables are not big and I have
indexes on the columns in the sql. Currently I am trying MQTs, but
when I was tuning them, I was changing the reopt parameter in the
set_routine_opt s procedure, and also playing with optimization level.
But I couldnt get db2 to give me different answer when I don't flush
package cache!! (eventhough I used reopt always). But since this is a
big db used by many other applications,
I cannot flush the package cache repeatedly. Is there a way to flush
just the sql's execution plan in the memory instead of the whole
thing? I know this is a big ask!!

So you've altered the SP to be REOPT = ALWAYS?
Feb 5 '08 #4
On Feb 5, 3:01*pm, jefftyzzer <jefftyz...@sbc global.netwrote :
On Feb 5, 11:58 am, Arun Srinivasan <arunro...@gmai l.comwrote:
I've been trying to tune this complex sql that uses the 'exists'
clause. It is damn slow, even though the tables are not big and I have
indexes on the columns in the sql. Currently I am trying MQTs, but
when I was tuning them, I was changing the reopt parameter in the
set_routine_opt s procedure, and also playing with optimization level.
But I couldnt get db2 to give me different answer when I don't flush
package cache!! (eventhough I used reopt always). But since this is a
big db used by many other applications,
I cannot flush the package cache repeatedly. Is there a way to flush
just the sql's execution plan in the memory instead of the whole
thing? I know this is a big ask!!

So you've altered the SP to be REOPT = ALWAYS?
Yes, I used set_routine_opt s ('REOPT ALWAYS EXPLSNAP ALL QUERYOPT 7')
TO increase the optimization level. But the following is a part in the
output from db2exfmt.
Also, I ran the set_routine_opt s and the sql in the same command
window. Thus the options should be valid for the session right?

SQL Type: Dynamic
Optimization Level: 5
Blocking: Block All Cursors
Isolation Level: Cursor Stability
Please advise.
Feb 6 '08 #5

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

Similar topics

4
7632
by: xixi | last post by:
the formula for package cache hit ratio is 1 - (package cache inserts/package cache lookups), what the result would be a effective ratio? currently we have cache inserts=25, cache lookups=35, so i get ratio =0.28, is this a good number?
10
4857
by: datapro01 | last post by:
Running DB2 8.1.6A on AIX 5.1 We are experience package cache overflows. The high water mark for package cache is showing as 16,108,513 bytes, or approximately 3933 4K pages. The package cache size is set at Maxapples * 8 Maxapples is at 500.
3
5608
by: Kyle Brandon | last post by:
Is there a way to flush the cache from a web service? basically i want to force a cache flush if there was an underlying database change so that subsequent calls would get new data...
0
1346
by: ECathell | last post by:
I need to flush the ?cache? on a console application. I have supervisors who are allowed to override functions but then unauthorized users can simply arrow up through the inputs. I can not use standard key disable because this is on a laser scanner and not a normal keyboard. How do I flush the command cache? -- --Eric Cathell, MCSA
0
1931
by: shterke | last post by:
Good day, I've been monitoring a DB2 system and noticed a low package cache hit ratio, I calculated it based on the formula in the db2 information center: (1-(db.pkg_cache_inserts/db.pkg_cache_lookups))*100 as you can see below the average (most of the time) of the package cache hit ratio is 30%
3
2769
by: PaulR | last post by:
Hi, I am trying to understand what invalidates Dynamic Packages in the Package Cache. By monitoring the Size of the Package Cache, it appears the following does 1. Performing a Runstats on all Tables reduces the Used Package Cache from some 200+MB to about 30MB ??
10
3596
by: Peter Larsen [] | last post by:
Hi, Is is possible to programmatically flush all opened files ?? BR Peter
0
1889
by: Ian | last post by:
Patrick Finnegan wrote: Yes. It doesn't matter where you execute the statement from. Is your question of "how do I check" asking how you check whether it works when executed from a client? Or are you asking how you check if the cache was actually flushed? If this is the case, compare the output from 'db2pd -db X -dynamic' before and after you flush the cache. Of course, you'll need to be
2
8963
by: Damir | last post by:
Hello! I have noticed that after (sucessfully) executing the command: FLUSH PACKAGE CACHE DYNAMIC the dynamic SQL statement cache is not completely cleared (some of the dynamic SQL statement elements are not reset). For example, looking at the dynamic SQL snapshot I see a certain SQL statement that has been executed a number of times and has read a (big) number of rows. Then I execute the "FLUSH PACKAGE CACHE DYNAMIC" command.
0
9685
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10237
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.