Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle partition table row count

#Run this to generate a set of selects for each partition

SELECT 'SELECT ' || chr(39) || partition_Name || chr(39) || ', count(*) 
        FROM ' ||table_name ||' partition (' || partition_name || 
        ') UNION ALL ' as test 
FROM all_tab_partitions 
WHERE table_Name = 'Table_1';
#Results in something like:

SELECT 'P1', count(*) FROM Table_1 partition (P1) UNION ALL 
SELECT 'P2', count(*) FROM Table_1 partition (P2) UNION ALL 
SELECT 'P3', count(*) FROM Table_1 partition (P3) UNION ALL 
SELECT 'P4', count(*) FROM Table_1 partition (P4) UNION ALL 
SELECT 'P5', count(*) FROM Table_1 partition (P5) UNION ALL
#Copy and paste results removing last union all and then run.
Comment

PREVIOUS NEXT
Code Example
Sql :: show query code after create table in sql 
Sql :: mysql declare variable 
Sql :: create table in mysql mariadb primary key foreign key 
Sql :: oracle shrink table 
Sql :: regexp in mysql 
Sql :: alter table myisam to innodb 
Sql :: host 127.0 0.1 is not allowed to connect to this mysql server 
Sql :: sql server to uppercase 
Sql :: reindexing all tables sql server 
Sql :: select distinct postgres 
Sql :: how to load files in mysql 
Sql :: how to change db owner postgres 
Sql :: create tablespace oracle multiple datafiles 
Sql :: data formate in sql 
Sql :: setval max id postgresql sequence 
Sql :: create table with index mysql 
Sql :: counting in sql 
Sql :: view table mysql 
Sql :: subquery in sql 
Sql :: sql max of two values 
Sql :: sql auto_increment syntax 
Sql :: postgres role does not exist 
Sql :: sqlite show columns 
Sql :: sql where part of string match 
Sql :: sql create tabel with primary key auto_increment code 
Sql :: coalesce sql 
Sql :: sql last time database was accessed 
Sql :: sql server today minus n 
Sql :: const pool = mysql.createpool() 
Sql :: mysql GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =