I am looking for an SQL query to give me that kind of output:
table_owner  table_name  partition_name  data (bytes)  indexes (bytes)
MY_OWNER     MY_TABLE    P01             12345678      23456789
MY_OWNER     MY_TABLE    P02             34567890      45678901
MY_OWNER     MY_TABLE    P03             56789012      67890123
...
I visited How do I calculate tables size in Oracle but didn't find what I am looking for, because it is always per table, per owner/schema but never per partition.
I know that the amount in bytes may not really be representative of the reality since it could be "real bytes in disk" and/or "bytes preallocated" (and real data could only use 1% of this preallocated space), but I am open to have this value even if it is the preallocated or the real amount of bytes used.
Notes:
- Using Oracle 18c Enterprise
- We do NOT care about system tables, ORACLE tables, maintenance tables, etc. just focusing on tables created by myself for the data
- Tablespace name is ALWAYS the same for all partitions in all tables in the same schema, and of course each tablespace name is different for each schema
- No need to round in Kb,Mb,Gbor evenTb, if possible I would prefer it inbytes.
- No need of pourcentage, no need of max space available
- I only use partitions, NOT anysubpartitions
- I can use a PL/SQL block if we need to loop on each schema, table and partition
- Guessing I can run this query by any user
Any idea?
 
    