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

Index Utilization at Database level

Hello, I'm looking for a method to check the utilization of index by
any SQL (Static and Dynamic) at the database level instead of
generating the access plan for each SQL.

I have inherited a database where index occupies more space than the
data and most of the indexes are looking redundant to me hence I would
like to check each index utilization and drop the same if it is not
used.

Env: DB2 UDB 8.2 /AIX 5.3
Thanks,
Sam

May 23 '06 #1
7 2106
Sam,

I know it is not what you are looking for, but may want to start with
catalog tables syscat.packagedep and syscat.statements.They will help
you to identify embedded sql stmts and indexes in the packages.

Regards,

Mehmet Baserdem

May 23 '06 #2
re***********@gmail.com wrote:
Hello, I'm looking for a method to check the utilization of index by
any SQL (Static and Dynamic) at the database level instead of
generating the access plan for each SQL.

I have inherited a database where index occupies more space than the
data and most of the indexes are looking redundant to me hence I would
like to check each index utilization and drop the same if it is not
used.

Env: DB2 UDB 8.2 /AIX 5.3
Thanks,
Sam

You should take a look at DB2 Query Patroller:

http://www-306.ibm.com/software/data...uerypatroller/

Larry Edelstein
May 23 '06 #3
hi Sam,

You can use the index advisor to find out the unused indexes and which
will give the necessary index you should have in your database.

1.) First set up the following tables
EXPLAIN_ARGUMENT
EXPLAIN_INSTANCE
EXPLAIN_OBJECT
EXPLAIN_OPERATOR
EXPLAIN_PREDICATE
EXPLAIN_STATEMENT
EXPLAIN_STREAM

There is a script which will automatically create these tables for
you..I forgot the location..will let you know ASAP.

2.) You should store all your sql in a file(query.in for example).

3.) run command

db2advis -d database_name -i query.in -t 5 -n schema_name

which will show some thing like below ::

total disk space needed for initial set [ 0.405] MB
total disk space constrained to [ 9.683] MB
Trying variations of the solution set.
Optimization finished.
37 indexes in current solution
[406.4958] timerons (without recommendations)
[ 36.6679] timerons (with current solution)
[90.98%] improvement
-- LIST OF RECOMMENDED INDEXES
-- ===========================
-- index[1], 0.009MB
CREATE UNIQUE INDEX "schemaname "."IDX603090642270000" ON
"schemaname "."T_CNTR " ("CNTR_CAT_CDE" ASC, "CNTR_SUB_CAT_CDE" ASC)
INCLUDE ("PROD_TYP_CDE") ALLOW REVERSE SCANS ;
COMMIT WORK ;
RUNSTATS ON TABLE "schemaname "."T_CNTR" FOR INDEX "DB2GRA
"."IDX603090642270000" ;
COMMIT WORK

-- RECOMMENDED EXISTING INDEXES
-- ============================
-- RUNSTATS ON TABLE "schemaname "."tablename" FOR INDEX "schemaname
"."PK_CNTRY" ;
-- COMMIT WORK ;
-- UNUSED EXISTING INDEXES
-- ============================
-- DROP INDEX "WDI "."IO1";
-- DROP INDEX "WDI "."IO2";

May 24 '06 #4
rAinDeEr,

Did you mean to say "db2 -tf EXPLAIN.DDL"

The "query.in" file will not cover all statements/scenarios. Isn't Sam
still need historical usage data for indexes?

Is there any way to log/archieve all sql stmts ever issued to database
server?

regards,

Mehmet Baserdem

May 24 '06 #5
Yes Mehmet,

I was talking about EXPLAIN.ddl which will create the tables. When we
run the db2advis it will recommend the new indexes and the utilisation
of the indexes and think that was exactly what Sam needed.

Also the redundant indexes are found by the advisor and is recommended
to DROP.

You can have the all the SQL's stored the file. I am not sure of a way
to capture dynamic SQL's.

You need db2audit to log all SQL submitted - The audit facility acts at
an instance level, recording all instance level activities and database
level activities.

thanks,
rAinDeEr

May 25 '06 #6

rAinDeEr wrote:
You can have the all the SQL's stored the file. I am not sure of a way
to capture dynamic SQL's.


If you have a new enough version of DB2 (I think 8.2), then you can use
the -g option to pull the queries from a dynamic SQL snapshot.
Alternatively, you can also use the -qp option to pull queries from
Query Patroller (or, apparently, use the GUI to gather a more
interesting range of data form the Query Patroller). These options are
documented in the infocenter. Unfortunately, I'm not currently running
a new enough version of DB2 to try either of these options out myself.

-ChrisC

May 25 '06 #7
Thanks Chris and Reindeer. I would look at the options suggested by
you.

Sam..

May 26 '06 #8

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

Similar topics

4
by: Anks | last post by:
hi I am testing my applet to servlet communication program using appletviewer. as soon as i start the applet the cpu utilization reaches to 100%.I am using apache tomcat 4.1 application...
12
by: Anon | last post by:
Hello all, I'm hoping for some guidance here... I am a c/c++ "expert", but a complete python virgin. I'm trying to create a program that loads in the entire FreeDB database (excluding the...
2
by: David Schwartz | last post by:
We are having quite a time since moving a large database to a new server (actually built new server, renamed as old to make seamless for users, etc.) Import 104 million row database (5 column)...
3
by: Dathon | last post by:
I have a Windows service that's built with .NET. The process is meant to run in the background and not suck up too much CPU time. I set the thread priority for the various threads in the service...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
4
by: matts.gustavsson | last post by:
I am running a standalone PC (DELL 1,73MHz with 504 MB of RAM) using Windows XPP Service Pack 2 and BD2 version 8.1 (the freeware version!). Right after start of the PC the process db2dasrrm.exe...
3
by: Sam Durai | last post by:
How can we find out CPU utilization at query level (which query is using how much % of CPU ) when multiple queries are running in parallel.. against DB2 database on AIX. Is there any utility, tool,...
1
by: Kaheru | last post by:
memory utilization increase? This is because when i try to keep track of the CPU utilization and memory utilization of my FTP server process (ftpserver.exe), the CPU utilization increase, but the...
2
by: Lennart | last post by:
What I'm looking for is a scenario where I can start some kind of monitoring and in a month or two inspect how many rows have been read via each index in a database. Preferably the monitoring...
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...
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
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,...
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
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...
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.