MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Record count in each partition

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
SMS
Beginner


Joined: 16 Oct 2005
Posts: 53
Topics: 24

PostPosted: Fri Sep 14, 2007 2:23 pm    Post subject: Record count in each partition Reply with quote

Hi,

I am trying to get the record count in each partition for a 50 part table using the below Unload card. But it returns the record count for the whole table space.

UNLOAD TABLESPACE TT01001D.FS00310T PART(90)
LOCK NO
SELECT 'PARTITION 90- ' || DIGITS(COUNT(*)) FROM DB1.INVENTRY

Since the runstats is not running regulary I cannot take it from TABLESPACESTATS or SYSTABLEPART tables.

Do I need to change anything in the unload card ? Any suggestions please ?
_________________
Regards,
SMS
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Mon Sep 17, 2007 9:15 am    Post subject: Reply with quote

You can use LISTDEF and TEMPLATE along with UNLOAD to create a separate file for each partition. Here's an example:

Code:

LISTDEF UNLDLIST
  INCLUDE TABLESPACE DB001.TS001 PARTLEVEL
TEMPLATE UNLDDS DSN TESTQUAL.&JO..&SS..&DB..&TS..P&PA.
  UNIT DISK DISP (NEW,CATLG,DELETE) SPACE (25,5) MB
TEMPLATE PUNCHDS DSN TESTQUAL.&JO..&SS..&DB..&TS..LOADCRDS
  UNIT DISK DISP (NEW,CATLG,DELETE) SPACE (1,1) CYL
UNLOAD LIST UNLDLIST PUNCHDDN PUNCHDS UNLDDN UNLDDS
  SHRLEVEL CHANGE ISOLATION UR NOPAD


Check the TEMPLATE command in the Utilities manual for a description of all the symbolic parms available.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Sep 17, 2007 9:52 am    Post subject: Reply with quote

SMS,

You can also isse the partition limit key(defined at the time of the table creation) and do a count(*) with the that key.

ex:
Code:

PART 1 VALUES ('xxxxxx' ) 
PART 2 VALUES ('yyyyyyy'  )
PART 3 VALUES ('zzzzzzzz' ) 


Code:

Select count(*) from table where pk_key <= part1 value;
Select count(*) from table where pk_key > part1 value and pk_key <=  part2 value;
..


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
showkath
Beginner


Joined: 23 Mar 2005
Posts: 17
Topics: 7

PostPosted: Mon Sep 17, 2007 11:55 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for your suggestion.
Actually it's a 100 part table and it has two partition keys. so I have to write 100 Select queries to get the record count based on the partition range. I thought of looking for a simple solution than this.


Jsharon,

Thanks. As part of table space expansion we are dropping a table space and re-creating it. As part of verification, after unloading the data from the production before dropping the TS, we plan to take the record count in each partition to compare it finally. For unloading the data, the unload jobs are already built which will unload in separate files.

For taking the record count, I heard that, using UNLOAD job, we can get the record count based on the partition number without using the partition keys. So I am experimenting on the same.

Please let know whether it's possible to get like that.

Thanks & Regards,
SMS
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Sep 17, 2007 12:00 pm    Post subject: Reply with quote

Quote:

I thought of looking for a simple solution than this.


The easiest and the best solution is run a REORG and it will update the table stats

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group