473,806 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6544
w.*********@goo glemail.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...@goo glemail.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.alb ert" <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...@goo glemail.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 misunderstandin g 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_OPT S_GET_ROUTINE_O PTS()||' 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.alb ert" <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_c md('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
(DesignChangeRe quest) 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
(DesignChangeRe quest) 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.alb ert" <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
(DesignChangeRe quest) 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

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

Similar topics

17
14080
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 query that executed quite quickly in our dev environment was painfully slow in production. I analyzed the the plan on the production server (it looked good), and then tried quite a few tips that I'd gleaned from reading newsgroups. Nothing worked....
0
3740
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. Every row in the source tables has a generated integer id. Every row in both the source and staging tables has a unique publicid (varchar(22)). All foreign key references in the staging tables are through publicids. (The foreign key reference could...
11
16300
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 equivalent to the SQL 'with' using TSQL? If there is not one, what is the TSQL solution to creating a temporary table that is associated with an SQL statement? Examples would be appreciated. Thank you!!
0
1479
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 requested function does not apply to declared temporary
1
2316
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 -- Chris Weston
1
1533
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 100K rows. I also drop the indexes before the builds and reindex after. Thats an aside. What I am wondering is how is this impacting the statistics? Do I need to update them? Not well versed on statistics and any data is welcomed. Thanks Rob
0
6638
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? I'm not a db admin, so any help would be grateful. Regards,
2
2356
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 different behaviour. Both tables are allocated in the same database and storage space and use the same buffer pool. The DB2 subsystem is Version7.1 on z/OS. On both tables I've run REORG with standard statistics. I've checked for stale statistics...
3
8764
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 CARDINALITY) do not use statistics. I would just like to clarify this statement. Does this mean that no statistics at all are used when determining the execution plan? or does this mean that statistics applying to cardinality are not used when...
0
9597
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10369
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10110
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
9187
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...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
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
5546
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
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.