I have a table that I was able to cout the number of rows e.g
select count(*) from emp
This emp table has been partitioned on the sal column into months. Each partition on the sal column
My question is how do I count the number of rows from each partition? Is that possible?
If so how? Can anybody do an example?
select count(*) from emp partition (sal_jan2000) will get the info from one partition.
select count(*) from emp partition (sal_jan2000 )
Thanks for the prompt reply.
I tried the earlier suggested method to this particular scenario below but it did not work.
Below is the exact scenario:
I have a table called SALES and it has been altered and partitions have been added to it. This is the way it was altered to add the partitions like I have below:
alter table sales
add partition jan_2000 values less than ('01-feb-2000')
How do I count all the rows in jan_2000 partition using select count(*)?
>I tried the earlier suggested method to this particular >scenario below but it did not work.
How it did not worked: some Oracle version does not support this syntax or has bugs (version 815 hasthe syntax. As for bugs, there are some, like CBO and RULE based optimizer modes returns different number of rows.)
Okay lets start again assuming I never asked the previous question.
This is the query that I got when I selected table_name, Partition_name, tablespace_name from dba_tab_partition
TABLE_NAME PARTITION_NAME TABLESPACE_NAME
--------------- --------------------- ----------------------
SALES SALES_JAN2000 SALES_TABLESPACE
How do I count the number of rows in partition sales_jan2000?
NOTE: I am running 8.I.5 on Sun solaris
[Edited by mybear on 02-01-2001 at 07:55 AM]
NORMALLY it works:
select count(*) from SALES