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

Statistics on temporary tables?

Is it possible to have statistics on temporary tables? I frequently
put 10000 or more rows in a temporary table and would like to know it
the queries become faster with statistics on those tables.
Sep 13 '08 #1
10 6497
w.*********@googlemail.com wrote:
Is it possible to have statistics on temporary tables? I frequently
put 10000 or more rows in a temporary table and would like to know it
the queries become faster with statistics on those tables.
Absolutely.
If you want to programatically collect statistics with a procedure
declaring a temp use the ADMIN_CMD() procedure

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Sep 13 '08 #2
Ok, that works. Now I want the explain with detailed information:
Which subsection works on what part of the SQL? This is provided by
"dynexplain" or "db2expln". But: I can't run statistics and then make
the explain, because for "db2expln" in the -setup option no runstats
are supported.
So I have NO chance to see the "optimzed" distribution of the SQL into
subsections when using runstats on DGTTs.
This is very helpful for further analysis: Which part of the running
SQL causes this high CPU/MEM-usage in subsection 6 (e.g.). This
information is given by snapshot for application for a running SQL.
But with runstats NO chance to see the part of SQL which is processed
in subsection 6...
On Sep 13, 8:31*pm, Serge Rielau <srie...@ca.ibm.comwrote:
w.l.fisc...@googlemail.com wrote:
Is it possible to have statistics on temporary tables? I frequently
put 10000 or more rows in a temporary table and would like to know it
the queries become faster with statistics on those tables.

Absolutely.
If you want to programatically collect statistics with a procedure
declaring a temp use the ADMIN_CMD() procedure

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Sep 24 '08 #3
On Sep 24, 1:40*am, "stefan.albert" <stefan.alb...@spb.dewrote:
Ok, that works. Now I want the explain with detailed information:
Which subsection works on what part of the SQL? This is provided by
"dynexplain" or "db2expln". But: I can't run statistics and then make
the explain, because for "db2expln" in the -setup option no runstats
are supported.
So I have NO chance to see the "optimzed" distribution of the SQL into
subsections when using runstats on DGTTs.
This is very helpful for further analysis: Which part of the running
SQL causes this high CPU/MEM-usage in subsection 6 (e.g.). This
information is given by snapshot for application for a running SQL.
But with runstats NO chance to see the part of SQL which is processed
in subsection 6...

On Sep 13, 8:31*pm, Serge Rielau <srie...@ca.ibm.comwrote:
w.l.fisc...@googlemail.com wrote:
Is it possible to have statistics on temporary tables? I frequently
put 10000 or more rows in a temporary table and would like to know it
the queries become faster with statistics on those tables.
Absolutely.
If you want to programatically collect statistics with a procedure
declaring a temp use the ADMIN_CMD() procedure
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Hi, Stefan.

It's quite possible I'm misunderstanding the core problem you're
trying to solve, so please bear with me, but if the issue is that you
want to EXPLAIN against the DGTT (indeed, the SQL in stored
procedures), you'll want to set a precompile option, to wit:

CALL SET_ROUTINE_OPTS_GET_ROUTINE_OPTS()||' EXPLAIN ALL');

And then run, e.g., db2exfmt

If the issue is that you're just lamenting that only abridged
statistics are collected and displayed for DGTTs, you're right.

--Jeff
Sep 24 '08 #4
Hi Jeff,

the problem is, that with db2exfmt I don't see the the subsections
involved. This is only available with db2expln.
And to do this, the runstats have to be put in the -setup section to
run, not to be explained (which is quite trivial).
But "runstats" is not supported in the -setup section... (but "declare
global temporary table..." is!)

Why I want to see the subsections:
When SQL runs, I see the CPU/RAM usage of the agents in all
subsections.
Sometimes one subsection uses very much CPU/RAM.
This I want to analyze and try to reduce this. Therefore I need to
know which part of the (complex) SQL is processed in this special
subsection... to change it and see what happens...
Sep 25 '08 #5
On Sep 25, 1:27*am, "stefan.albert" <stefan.alb...@spb.dewrote:
Hi Jeff,

the problem is, that with db2exfmt I don't see the the subsections
involved. This is only available with db2expln.
And to do this, the runstats have to be put in the -setup section to
run, not to be explained (which is quite trivial).
But "runstats" is not supported in the -setup section... (but "declare
global temporary table..." is!)

Why I want to see the subsections:
When SQL runs, I see the CPU/RAM usage of the agents in all
subsections.
Sometimes one subsection uses very much CPU/RAM.
This I want to analyze and try to reduce this. Therefore I need to
know which part of the (complex) SQL is processed in this special
subsection... to change it and see what happens...
I see. Sounds like I was talking out of turn, as you appear to be
either DPF/EEE or z/OS, neither of which I've experience with. My bad.

--Jeff
Sep 25 '08 #6
Ian
stefan.albert wrote:
Hi Jeff,

the problem is, that with db2exfmt I don't see the the subsections
involved. This is only available with db2expln.
And to do this, the runstats have to be put in the -setup section to
run, not to be explained (which is quite trivial).
But "runstats" is not supported in the -setup section... (but "declare
global temporary table..." is!)
As serge suggested, you can use:

call sysproc.admin_cmd('RUNSTATS ON TABLE SESSION....')

Sep 25 '08 #7
Hi Jeff, Ian,

we have an AIX box using DB2 v9.1 FP4 with DPF - thats our
environment.

I tried 3 different ways to run runstats on a DGTT:

1) "simple" runstats command
2) CALL ADMIN_CMD('... - as Ian mentioned that this Serge mentioned
3) we have also a stored procedure using an UDF with external C-
Programm for running runstats via API

All 3 ways fail with the same error.
I had PMR 78890.077.724 about this problem which lead to DCR
(DesignChangeRequest) MR0806087129.

No more informations about since then...
I posted this with the hope, that Serge or another IBMian could bring
a bit more activity to our problem.
Thanks.
Sep 26 '08 #8
stefan.albert wrote:
Hi Jeff, Ian,

we have an AIX box using DB2 v9.1 FP4 with DPF - thats our
environment.

I tried 3 different ways to run runstats on a DGTT:

1) "simple" runstats command
2) CALL ADMIN_CMD('... - as Ian mentioned that this Serge mentioned
3) we have also a stored procedure using an UDF with external C-
Programm for running runstats via API

All 3 ways fail with the same error.
I had PMR 78890.077.724 about this problem which lead to DCR
(DesignChangeRequest) MR0806087129.

No more informations about since then...
I posted this with the hope, that Serge or another IBMian could bring
a bit more activity to our problem.
Thanks.
If you don't think your PMR is getting the proper attention escalate it.
I'm a poor escalation process... ;-)

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Sep 28 '08 #9
On Sep 26, 4:01*am, "stefan.albert" <stefan.alb...@spb.dewrote:
Hi Jeff, Ian,

we have an AIX box using DB2 v9.1 FP4 with DPF - thats our
environment.

I tried 3 different ways to run runstats on a DGTT:

1) "simple" runstats command
2) CALL ADMIN_CMD('... - as Ian mentioned that this Serge mentioned
3) we have also a stored procedure using an UDF with external C-
Programm for running runstats via API

All 3 ways fail with the same error.
I had PMR 78890.077.724 about this problem which lead to DCR
(DesignChangeRequest) MR0806087129.

No more informations about since then...
I posted this with the hope, that Serge or another IBMian could bring
a bit more activity to our problem.
Thanks.
I'm curious that if you create index on a GTT using

create index ..... allow reverse scans collect statistics

will stats be collected automatically when the index is created?
Assume the above "create index" is run after the data are inserted and
before the GTT is used in queries.

Thanks.

Oct 19 '08 #10
Hi,

Yes, if you collect statistics on an index created after filling the
temp table of Data, you will have your index with current stats. But
Table statistics will be "out of date".

You will get the message:

Some statistics are in an inconsistent state. The newly collected
"INDEX" statistics are inconsistent with the existing "TABLE"
statistics
Nov 17 '08 #11

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...
0
by: Jerry Brenner | last post by:
Our users have potentially dirty legacy data that they need to get into our application. We provide a set of staging tables, which map to our source tables, that the users do their ETL into. ...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
0
by: Guru | last post by:
Hi All i used this statement to create a temporary table index. Create index session.indname on session.tablename collect statistics. it throws an error saying that SQL0526N The...
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...
0
by: Bucker | last post by:
Could someone view the following that I copied from phpMyAdmin and tell me from the statistics if are server is running OK? Does it look like we will have problems as more people hit our server?...
2
by: Ulrike Klusik | last post by:
Hello Folks, i've got two structural identical tables (including tablespace and indexes) with identical data, on which the access path of an SQL is differs. But I don't see a reason for the...
3
by: Otto Carl Marte | last post by:
>From the IBM db2 docs: http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/t0005308.htm it says that volatile tables (ALTER TABLE mytable VOLATILE...
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
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
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
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
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.