Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine the size of a SQL result set in KB

I am hoping to find how I can get the kb size of a result set in OracleDB. I am not an sysadmin, but often run queries that return over 100k rows and I would need to find a way to determine what is the total kb size. thank you

like image 413
shermy Avatar asked Sep 11 '09 13:09

shermy


People also ask

How do I find the size of a SQL query result?

If you need to check a single database, you can quickly find the SQL Server database sizein SQL Server Management Studio (SSMS): Right-click the database and then click Reports -> Standard Reports -> Disk Usage. Alternatively, you can use stored procedures like exec sp_spaceused to get database size.

How do you calculate result set data size?

Simply iterate on ResultSet object and increment rowCount to obtain size of ResultSet object in java. rowCount = rs. getRow();

How do I know the data size of my select query?

you can insert the result into a middle table after querying, then you can get the size from object explorer.

How do I find the size of a table in SQL?

This can be accomplished easily with the following query: SELECT TABLE_SCHEMA AS `Database`, TABLE_NAME AS `Table`, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` FROM information_schema.


1 Answers

In SQL*Plus:

SET AUTOTRACE ON

SELECT *
FROM emp
WHERE rownum <= 100;

        27  recursive calls
         0  db block gets
        19  consistent gets
         4  physical reads
         0  redo size
     **11451  bytes sent via SQL*Net to client**
       314  bytes received via SQL*Net from client
         8  SQL*Net roundtrips to/from client
         0  sorts (memory)
         0  sorts (disk)
       100  rows processed

To use AUTOTRACE requires the PLUSTRACE role, which is not granted by default. Find out more.

like image 196
jva Avatar answered Sep 27 '22 23:09

jva