Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle - How do I get the actual size of a specific ROW?

Tags:

oracle

size

row

Is this possible? Or at least I'm looking to have a list of the size of all rows in a table.

like image 940
danboh Avatar asked May 03 '11 14:05

danboh


People also ask

How do I find the row size in Oracle?

if you're interested in the average row length, you could analyze the table (with the DBMS_STATS package), then query ALL_TABLES. avg_row_len . It may return lower value than sum of column lengths in bytes.

How do I select a specific row in Oracle?

You can do with an auxiliary operation. Firstly number the rows by row_number() function and then order by them : select * from ( select row_number() over (order by 0) rn, t.

How do I find the size of a specific table in Oracle?

select segment_name,segment_type, sum(bytes/1024/1024/1024) GB from dba_segments where segment_name='&Your_Table_Name' group by segment_name,segment_type; Storage.

How do I find the maximum row size in SQL?

MS SQL server allows only 8060 bytes of data max to be stored in a row. Hence your row size will always be <= 8060. But it is relaxed when a table contains varchar, nvarchar, varbinary, sql_variant, or CLR user-defined type colums.


2 Answers

select vsize(col1) + vsize(col2) + vsize(col3) + 
long_raw_length_function(long_col) + DBMS_LOB.GETLENGTH(blob_col) 
from table 
where id_col = id_val;

for the long_raw_length_function, see this Get the LENGTH of a LONG RAW

like image 176
bpgergo Avatar answered Oct 20 '22 07:10

bpgergo


if you're interested in the average row length, you could analyze the table (with the DBMS_STATS package), then query ALL_TABLES.avg_row_len.

like image 29
Vincent Malgrat Avatar answered Oct 20 '22 06:10

Vincent Malgrat