473,728 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Empty Query Cache

Hello,

Running a query for the first time on DB2 takes a fixed amount of time.
But when query is executed for the second time, the amount of time is
usually less since the query is (most probably) cached already.

I would like to clear out the DB2-UDB 8.2 query cache (I want the
previous execution time again).

Any advice would be appreciated.

Thanks.

Regards,
Salem

Nov 12 '05 #1
6 10000
"UnixSlaxer " <un********@hot mail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hello,

Running a query for the first time on DB2 takes a fixed amount of time.
But when query is executed for the second time, the amount of time is
usually less since the query is (most probably) cached already.

I would like to clear out the DB2-UDB 8.2 query cache (I want the
previous execution time again).

Any advice would be appreciated.

Thanks.

Regards,
Salem

There are two different cache's. One is the package cache which has the
execution plan. You can clear this with flush package cache.

The other is the bufferpool(s) that cache the tables and indexes (and system
catalog). The only way to clear it out is to run other large queries that
forces the old data out of the bufferpools, or more reliably, you can use
the activate database and deactivate database command.

Without any connections to the database, attach to the instance and activate
the database. Then connect to the database and run the query. The terminate
all connections to the database (db2 terminate for each connection), and
deactivate the database. Then to run the query again, repeat the steps above
(the bufferpools will be empty each time).

I am not sure why you are doing this, since DB2 is designed to use
bufferpools extensively to reduce synchronous I/O.
Nov 12 '05 #2
Thank you for your response.

I am doing this for performance and experimental evaluation.

Regards,
Salem
Mark A wrote:
"UnixSlaxer " <un********@hot mail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hello,

Running a query for the first time on DB2 takes a fixed amount of time.
But when query is executed for the second time, the amount of time is
usually less since the query is (most probably) cached already.

I would like to clear out the DB2-UDB 8.2 query cache (I want the
previous execution time again).

Any advice would be appreciated.

Thanks.

Regards,
Salem

There are two different cache's. One is the package cache which has the
execution plan. You can clear this with flush package cache.

The other is the bufferpool(s) that cache the tables and indexes (and system
catalog). The only way to clear it out is to run other large queries that
forces the old data out of the bufferpools, or more reliably, you can use
the activate database and deactivate database command.

Without any connections to the database, attach to the instance and activate
the database. Then connect to the database and run the query. The terminate
all connections to the database (db2 terminate for each connection), and
deactivate the database. Then to run the query again, repeat the steps above
(the bufferpools will be empty each time).

I am not sure why you are doing this, since DB2 is designed to use
bufferpools extensively to reduce synchronous I/O.


Nov 12 '05 #3
Hi,

UnixSlaxer wrote:
Thank you for your response.

I am doing this for performance and experimental evaluation.


well. File system caching could be an issue as well, as long as you have
not created all tablespaces with "no file system caching", direct IO or
raw devices.

Your disk controllers may do some caching as well.

What I try to say: Difficult to compare just by flushing the databases
caches. The second run could give a different execution time, either.

I would probably try it the opposite way, but that´s just a guess.

How about creating a script which takes care of _filling_ the
bufferpools with data ,run it before each of your tests and
deactivate/activate db in between?

Could be closer to your real life scenario and you would not need to
reboot your server between the tests.

Depends on your actual needs, of course. Never tried to benchmark my
applications like this.

just my 2 ct´s
Norbert
Nov 12 '05 #4
"Norbert Munkel" <nm@acoreus.d e> wrote in message
news:d8******** *****@news.t-online.com...

well. File system caching could be an issue as well, as long as you have
not created all tablespaces with "no file system caching", direct IO or
raw devices.

Your disk controllers may do some caching as well.

What I try to say: Difficult to compare just by flushing the databases
caches. The second run could give a different execution time, either.

I would probably try it the opposite way, but that´s just a guess.

How about creating a script which takes care of _filling_ the bufferpools
with data ,run it before each of your tests and deactivate/activate db in
between?

Could be closer to your real life scenario and you would not need to
reboot your server between the tests.

Depends on your actual needs, of course. Never tried to benchmark my
applications like this.

just my 2 ct´s

Norbert


The TPC-H benchmarks stipulate that each query be run 6 times (I believe) to
get an average execution time (although it is slightly more complicated than
that). There are 22 queries in the TPC-H benchmark.
www.tpc.org
Nov 12 '05 #5
Hi Mark,

Mark A wrote:
The TPC-H benchmarks stipulate that each query be run 6 times (I believe) to
get an average execution time (although it is slightly more complicated than
that). There are 22 queries in the TPC-H benchmark.
www.tpc.org


Right. Thank you for pointing me there. My point is: Does it ,
economically spoken, make sense to do benchmarks to this extent except
for marketing reasons?

If I like to figure out how to tune up my application, I spend most time
by analyzing access paths, thinking about what I can do to get better
ones and look at the snapshot data of the tests to verify my
assumptions. If I can´t see something which could save me at least about
1/2 hour of processing time a day, It is probably not worth working on it.

just my 2 ct´s

Norbert

Nov 12 '05 #6
"Norbert Munkel" <nm@acoreus.d e> wrote in message
news:mP******** ******@se2-cb104-9.zrh1.ch.colt. net...
Hi Mark,

Mark A wrote:
The TPC-H benchmarks stipulate that each query be run 6 times (I believe)
to get an average execution time (although it is slightly more
complicated than that). There are 22 queries in the TPC-H benchmark.
www.tpc.org


Right. Thank you for pointing me there. My point is: Does it ,
economically spoken, make sense to do benchmarks to this extent except for
marketing reasons?


The reason that the TPC-H benchmark requires 6 executions of each query is
precisely because the cache can make a difference from one execution to the
next, so an average score is needed. Probably 3 times is fine for most
purposes. But if you do clear the cache and bufferpools each time, then it
should be about the same each time.

But clearing the cache is not always ideal for analysis purposes, because
DB2 is meant to run with some data cached, which is more realistic than
clearing the cache every time. This is more of an issue if small, frequently
used tables and indexes, and the system catalog are put in a separate
bufferpool from the bigger tables.

Another issue is that there can be a big difference in execution time if
multiple queries are run at once. This is especially true if system
temporary tablespaces and other resources are not large enough.

One more thing. When I ran the TPC-H benchmark, I noticed that about 1/3 of
the queries ran MUCH faster with query optimization level of 7 (default is
5). This is especially true for very complex decision support queries. I
believe that IBM ran their benchmark with 7. Optimization level of 7 is
usually not appropriate for OLTP systems because of the extra overhead of
the SQL optimization required.
Nov 12 '05 #7

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

Similar topics

5
4236
by: Phil Powell | last post by:
I created a page that will be doing image resizing and manipulation, which seems to work (using GD library). However, upon returning to the page where the image has been changed, I still see the old image, until I refresh my browser and then zappo, there it is! All changed! I have done everything I can think of to force caching including this: // Date in the past header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
0
1704
by: Dylan Neild | last post by:
OK, I have a MySQL server running 4.0.12 on a 12 CPU Sun U4500 with 12GB of memory. With the query cache running, this machine would noticeably "hiccup" (just stop responding to requests) every so often and wouldn't squeeze more then 1000 queries per second or so as a result (heavily mixed OLTP work, with a lot of SELECT's and almost as many UPDATE's).
1
7157
by: steve | last post by:
Does SQL Server have a query cache similar to mysql, whereas the query result is cached, if the table has not been changed? If so, please refer me to more info. Thanks. -- http://www.dbForumz.com/ This article was posted by author's request Articles individually checked for conformance to usenet standards
2
7013
by: mabuHB | last post by:
I am trying to write a Wake-On-LAN utility for a local subnet. I can do the Wake-On-LAN, but before this I need to find the MAC addresses on the local LAN. I had planned to query DHCP on the WAN to get the MAC addresses, but there are security restrictions in place that will restrict this. I have therefore decided to ping all the devices on the local subnet, and then query the ARP Cache and pick out the MAC addresses. I have got the ping...
8
1654
by: Phoenix | last post by:
Here's a challenge that is killing me: I've got 2 web servers and a SQL Server and about 5,000 'users' who stay connected to the site all day. I have a page that is supposed to be 'real-time', so to do this, I have a 1px frame that refreshes every 15 seconds (so the other frame doesn't have to reload all the time--the top only reloads when a new record or a changed record hits the db). The real time data can be filtered in about 8...
4
13810
by: traceable1 | last post by:
I am trying to improve the performance of a query. No matter how bad it runs the first time, it runs really fast the second time. So how can I tell if I've done anything to improve the query if it always comes back quickly after the first run? I assume the query/data/plan is in cache - how can I clean it out for my session? Thanks in advance for any help you can provide -
26
2794
by: anonieko | last post by:
In the past I always used "" everywhere for empty string in my code without a problem. Now, do you think I should use String.Empty instead of "" (at all times) ? Let me know your thoughts.
17
2729
by: NeoAlchemy | last post by:
I am starting to find more web pages that are using a query parameters after the JavaScript file. Example can be found at www.opensourcefood.com. Within the source you'll see: <script src="/shared/scripts/common.js?revision=1.6" type="text/javascript">. I am trying to see if there is any big deal to this or a best practice that is starting to creep up in the JavaScript community. If this is used only as a way to distinguish what...
1
3039
by: Don Li | last post by:
Hi, Env: MS SQL Server 2000 DB Info (sorry no DDL nor sample data): tblA has 147249 rows -- clustered index on pk (one key of datatype(int)) and has two clumns, both are being used in joins; intersecTbl4AB has 207016 rows -- clustered index on two fks and
0
9411
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...
1
9188
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
9122
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8113
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...
0
6012
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4522
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4787
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3230
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
2
2643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.