# calculating size of a table

Show 40 post(s) from this thread on one page
Page 2 of 2 First 12
• 07-08-2005, 07:03 AM
jmodic
Quote:

Originally Posted by Vipassana
I think you have added more confusion :confused:

I think it's about time you finaly do some reading of oracle documentation, in particular The Concepts Manual.

Untill you don't have at least a slightest idea what each of your two queries are doing and untill you don't know some of the very basic Oracle database vocabulary, any further explanation will only add more confusion. But nevertheless, I'll try to address some of your questions:

Quote:

First of all which is which? I presume the first statement means "how much space is needed to store all those rows" and the second means "the other is how much space is actually allocated by that table".
I'll leave this for your homework - I hope you'll managed to find out which of your two queries is doing what.

Quote:

What does "all the rows" mean here?
It means all the rows that are currently in your PRODUCT table. It means NUM_ROWS from your first query.

Quote:

And also what does "how much space is needed..." mean?

Quote:

Thridly I didn't understand what you meant by "the other is how much space is actually allocated by that table". You mean how is actually used? If so "used out of what (how much)?"
As I said, take a look at the Concepts manual and read about "blocks" and "segments" and "extents", about "data files" and "tablespaces". It will all become so clear......
• 07-08-2005, 07:44 AM
TimHall
OK. Let's make this simple. The lack of detail in this answer is intentional!

Consider this:

You insert 1,000,000 rows into a new table, causing it to increase in size so it can hold all the rows. At the end of this load process the table is 1M in size. It's safe to say that it takes 1M to store 1,000,000 rows.

You then decide to delete 999,999 rows, leaving a single row in the table. The table has not shrunk so it is still 1M in size, but obviously has lots of emty space in it. Can we use the same logic as before to make a conclusion? No. If we did we would be saying that it takes 1M to store 1 row. That's obviously nonsense.

So what?

Well, measuring the size of a table by summing all the blocks or bytes gives you the size of the table, not the size of the data it is holding.

Estimating the size of the data based on num_rows and avg_row_length gives you an idea of the size of the data, not the current size of the table holding it.

What next?

Decide what you actually want to know:

- The size of the table currently.
- The size of the data in the table.
- Something else.

Cheers

Tim...
• 07-08-2005, 08:35 AM
hrishy
Hi Tim

I really really admire your patience :-D

regards
Hrishy
• 07-08-2005, 08:36 AM
hrishy
Hi

Oops i should be calling you rather Prof Tim

regards
Hrishy
• 07-08-2005, 09:27 AM
TimHall
Quote:

Originally Posted by hrishy
Hi Tim

I really really admire your patience :-D

regards
Hrishy

You wouldn't say that if you ever worked with me. I can be a right .... :)

Quote:

Originally Posted by hrishy
Hi

Oops i should be calling you rather Prof Tim

regards
Hrishy

Where did that come from?
• 07-10-2005, 09:48 PM
Vipassana
Hmmm lots of details. Good, now atleast I am clear that I lack certain basic fundamentals. Will give it a reading... and get back if I still have some clarifications. Thanks for all your time and patience guys.
• 07-11-2005, 12:02 AM
hrishy
Quote:

Originally Posted by TimHall
You wouldn't say that if you ever worked with me. I can be a right .... :)

Where did that come from?

Well thats becoz you had all the patience in the world to explain to the students here :-) Prof Tim
• 07-26-2007, 02:19 AM
mrameshchandra
URGENT: Table size in 9i
Hi,

the query

select sum(bytes) from user_segments where segment_name = 'tablename'; is giving sum(bytes) as blank, not even a zero. Please help. Does the user need dba permission to run this query?

Thanks and regards,
rcm
• 07-26-2007, 07:56 AM
PAVB
did you actually type the tablename in lowercase?
• 06-20-2015, 11:17 PM
ronenelr
Just encountered this post and thought some of the people encountering it as well and that would like to calculate existing row and table sizes in order to calculate the entire sizing impact of new rows in the database can use a script I wrote. The script predicts the extra size needed for new rows inserted into a table with the table indexes and all refereing tables (with foreign keys) as well. Might be useful as it was to me...

You can find it here.
(http://www.oraclehotspot.com/2015/06...ct-of-new.html)
Show 40 post(s) from this thread on one page
Page 2 of 2 First 12