![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
DB2 *LUW v9.1 Is there any IBM supplied view, function, etc. that gives cardinality per partition on a partitioned table? I can't find anything. |
#3
| |||
| |||
|
|
select dbpartitionnum(col1), count(*) from your_table group by dbpartitionnum(col1) |
#4
| |||
| |||
|
|
On 17.6.2010 17:31, Ian wrote: select dbpartitionnum(col1), count(*) * *from your_table group by dbpartitionnum(col1) Unfortunately this won't work because of an invalid use of the function. |
#5
| |||
| |||
|
|
select dbpartitionnum(col1), count(*) from your_table group by dbpartitionnum(col1) Unfortunately this won't work because of an invalid use of the function. What do you mean? |
|
Caveat: You'll only get counts for data partitions that actually have data. |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
I'm on v9.1, Range partition table is what I'm talking about. Looking for "card" by partition hidden in the catalogs somewhere and is updated with stats because I want a query to pull "card" for all tables in a database and the tables that are partitioned, I want "card" by partition. This doesn't work ... select seqno, card from syscat.datapartitions where tabname = 'your_table' ... there is no "card" column in syscat.datapartitions. I wished there was. It would solve my problem. This won't work for me either ... select datapartitionnum(col1), count(*) * *from your_table group by datapartitionnum(col1) ... because it's on an individual table. And querying each and every table would take way too long, especially numerous partitioned ones with numerous partitions containing hundreds of millions of rows. Am I out of luck? |
![]() |
| Thread Tools | |
| Display Modes | |
| |