473,387 Members | 1,379 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,387 software developers and data experts.

How I can get statistics by indexes using?

For example - very large table with a lot indexes and updates work very
slow. I'd like found unused or rarely used indexes. How? Yes, for
static I found all sql in packages and, after analyse, drop/recreate
some indexes. But for dynamic I have no idea. Only drop all and monitor
RR :-) Inhumanely, IMHO

Andy

Nov 12 '05 #1
5 1678

"bughunter@ru" <a.********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
For example - very large table with a lot indexes and updates work very
slow. I'd like found unused or rarely used indexes. How? Yes, for
static I found all sql in packages and, after analyse, drop/recreate
some indexes. But for dynamic I have no idea. Only drop all and monitor
RR :-) Inhumanely, IMHO

Dynamic SQL is, in effect, SQL that is generated live at the moment the
query is being run. For instance, if you go to a command line and write a
SELECT, INSERT, UPDATE, or DELETE statement, then press Enter, you are doing
dynamic SQL.

I don't see how you can possibly anticipate which indexes dynamic queries
will need before you've written them.

If you have somehow kept a large proportion of the dynamic SQL that you and
your users have written in the past, you might be able to analyze it and see
patterns that would tell you what indexes are likely to be used by those
queries, assuming that the queries written in the future are similar to the
ones written in the past. But dynamic SQL queries are often not saved and,
even if they are, future queries might differ substantially from queries in
the past. After all, if a dynamic query starts getting used heavily, it is
probably a good candidate to be made into static SQL, perhaps in an
application or stored procedure. Therefore, the most popular dynamic queries
probably become static queries over time and then dynamic queries will do
different things than they did when the database was newer.

It may be best to handle this problem reactively, i.e. drop all indexes that
aren't heavily used by your static queries and then wait for the users to
start screaming about dynamic queries that are suddenly much slower. Those
queries will give you big clues about where you need additional indexes - or
where dynamic queries should be made static by putting them in applications
or stored procedures.

Just my two cents worth....

Rhino
Nov 12 '05 #2
I hope you are using DB2 UDB V8.
Fromm your production environment, you can define a larger package cache
size to run your snapshots.
Package cache size (4KB) (PCKCACHESZ) = (MAXAPPLS*8)
Default - Siz in pages.
Update your db cfg to kmake it larger.
Let your system run for a while.
The package cache will hold as much as it can of the most recent dynamic and
static SQL stmts executed.
Then issue: db2 get snapshot for dynamic sql on <dbname>
Using that Snaphot info and DB2 Design Advisor, you can capture the sql and
get advisor to recommend/evaluate indexes.
HTH, Pierre.

--
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
"bughunter@ru" <a.********@gmail.com> a écrit dans le message de news:
11**********************@g44g2000cwa.googlegroups. com...
For example - very large table with a lot indexes and updates work very
slow. I'd like found unused or rarely used indexes. How? Yes, for
static I found all sql in packages and, after analyse, drop/recreate
some indexes. But for dynamic I have no idea. Only drop all and monitor
RR :-) Inhumanely, IMHO

Andy


Nov 12 '05 #3
I was told in an IBM class some time ago that UDB will store a maximum
of ONE dynamic query that DOES NOT USE PARAMETER MARKERS in the cache.

Is this still a valid statement?

Phil Sherman

Pierre Saint-Jacques wrote:
I hope you are using DB2 UDB V8.
Fromm your production environment, you can define a larger package cache
size to run your snapshots.
Package cache size (4KB) (PCKCACHESZ) = (MAXAPPLS*8)
Default - Siz in pages.
Update your db cfg to kmake it larger.
Let your system run for a while.
The package cache will hold as much as it can of the most recent dynamic
and static SQL stmts executed.
Then issue: db2 get snapshot for dynamic sql on <dbname>
Using that Snaphot info and DB2 Design Advisor, you can capture the sql
and get advisor to recommend/evaluate indexes.
HTH, Pierre.

Nov 12 '05 #4
Phil Sherman wrote:
I was told in an IBM class some time ago that UDB will store a maximum
of ONE dynamic query that DOES NOT USE PARAMETER MARKERS in the cache.
Is this still a valid statement?

No. Parameter markers are of no meaning to the cache. Given that many
apps don't use parameter markers (unfortunately) keeping only one in the
cache would wreck performance. I don't see any upsaide to such a
behaviour, actually.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #5
with static - yes. and I already do it. Drop all indexes on
productive... On very large table... Me will dismiss without the
severance pay :-)

Package cache snapshot for some cases very useful. But for tables
accessed through numerous views it will not help me - no pattern for
search. Everything, that is necessary for me, is the elementary
counter, how many times the index has been used. Exactly also me does
not suffice for the analysis of the elementary counter on RR from the
concrete table.

M.b. IBM can create new monitor type - snapshot monitor for table?
Which will be collect statistics like rr/rw, indexes use.

Nov 12 '05 #6

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

Similar topics

17
by: Felix | last post by:
Dear Sql Server experts: First off, I am no sql server expert :) A few months ago I put a database into a production environment. Recently, It was brought to my attention that a particular...
5
by: Jesper Jensen | last post by:
Hello group. I have an issue, which has bothered me for a while now: I'm wondering why the column statistics, which SQL Server wants me to create, if I turn off auto-created statistics, are so...
4
by: Sky Fly | last post by:
Hello all, I've written a stored procedure which runs OK for the first few thousand records it processes, then around about the 10,000th record it suffers a sudden and dramatic drop in...
3
by: Metal Dave | last post by:
Hello, A script we run against the database as part of the upgrade of our product is failing with the following message: ALTER TABLE ALTER COLUMN EncodedID failed because STATISTICS hind_61_3...
2
by: Ihug | last post by:
I have a database table with approx 3 million rows. There are 9 indexes on this table. The command: SHOW INDEX FROM TRAN; Returns results as expected with all indexes some valid "Cardinality"...
2
by: Lyn Duong | last post by:
Hi, I have a job that performs a runstats on tables in my database (db2 V8 on AIX) and the syntax is db2 runstats on table schema.tabname with distribution and detailed indexes all. when I...
1
by: Chris Weston | last post by:
Hi. I have automatic statistic update turned on for all my databases. Is this an overhead I can do without? Could I update them overnight when the database is hardly in use? Thanks --...
1
by: rcamarda | last post by:
As part of my data warehouse nightly build, I truncate my tables in my target database. As example, I find it is much quicker to do a bulk API load of 13M records and to do an update/insert of...
1
by: =?iso-8859-1?B?Qmr4cm4=?= | last post by:
I'm looking into the automatic recompilation of stored procedures and I have been reading up on the "Do not recompute statistics" option on indexes. Am I correct in concluding that disabling the...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.