473,396 Members | 2,057 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,396 software developers and data experts.

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 9896
"UnixSlaxer" <un********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.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********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.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.de> 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.de> 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
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...
0
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)...
1
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. --...
2
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...
8
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',...
4
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...
26
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
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...
1
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;...
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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...
0
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,...

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.