View previous topic :: View next topic
|
Author |
Message |
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi All,
I have a question. Is there any system table in DB2 (like SYSTABLES in SYSIBM), where in I can get the count of rows in each table in one particular region. For example there are 3 tables in region XYZ with creator ABC, and I require to know the number of rows in each of three tables without giving a count(*) query for each table.
Thanks,
Muffi |
|
Back to top |
|
|
LearningDb2
New User
Joined: 19 Jun 2009 Posts: 40 Location: India
|
|
|
|
Hi,
You can try real time statistics.
Query the table SYSIBM.SYSTABLESPACESTATS...in which count of rows is mantained..
Else you can try writing a simple procedure selecting table name as variable from SYSIBM.SYSTABLES. |
|
Back to top |
|
|
bauer
New User
Joined: 03 Mar 2009 Posts: 28 Location: germany
|
|
|
|
Try this:
Code: |
select sum(card)
from sysibm.systables
where creator = 'ABC' ;
|
|
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
bauer,
the query gave me a result -1036.
regards,
Muffi |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
I think its CARDF. |
|
Back to top |
|
|
rakesh17684
New User
Joined: 08 Oct 2006 Posts: 61 Location: San Diego
|
|
|
|
just a FYI.. i would be running the query on the SYSIBM tables only if RUNSTATS have been run on the above region and nothing is loaded after that on the same region. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
To sum up the previous answers :
It all depends on how accurate it has to be :
If you're happy with whatever was in CARDF at the time of the last runstats , a
select name,cardf from sysibm.systables where creator = 'ABC'
is sufficient.
If you're happy with an value that could be 30 minutes old and possibly completely wrong (when some utility failed or some obscure third party utility ran or a failure in data sharing), a select from sysibm.systablespacestats is OK. |
|
Back to top |
|
|
bauer
New User
Joined: 03 Mar 2009 Posts: 28 Location: germany
|
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
That link directs you to yoururl.com |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Link corrected. . .
Always a good idea to Preview and test a link that is being posted.
d |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi,
Thanks all for your help. It seems that runstats is necessary to obtain the CARD value from SYSTABLES. In my case the region 'ABC' is a new test region created and I am given a task to load all the tables with the load files given.
Hence runstats is executed on the database the value will not be populated in CARD field.
Thanks,
Muffi |
|
Back to top |
|
|
bauer
New User
Joined: 03 Mar 2009 Posts: 28 Location: germany
|
|
|
|
Ups, sorry for the incorrect link. No idea, why the link was incorrect. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
No idea, why the link was incorrect |
Because when the URL tag is used, it genereates [url=http://yoururl.com]Type_Description_Here giving the poster the ability to put the url "under" a description. If it is not changed, the link winds up being yoururl.com . . .
If the url itself is shown in the post, it is not necessary to use the url tag (see the previous sentence).
A bit of experimenting with Preview will show this better than i can describe it |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi,
Thanks a lot all.. I did a runstats on the database and was able to generate the counts of all the tables in a single go.
Thanks,
Muffi |
|
Back to top |
|
|
|