# Record size and table size with ActiveRecord?

**URL:** <https://www.ruby-forum.com/t/record-size-and-table-size-with-activerecord/111517>\
**Category:** Rails\
**Created:** [August 8, 2007, 6:23am UTC](https://www.ruby-forum.com/t/record-size-and-table-size-with-activerecord/111517 "2007-08-08T06:23:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [August 8, 2007, 6:23am UTC](https://www.ruby-forum.com/t/record-size-and-table-size-with-activerecord/111517/1 "2007-08-08T06:23:46Z")

</div>

What is the best way to find the record size and table size in a  
database using ActiveRecord? And will that method indicate actual disk  
space?

If not, how do I do it with SQL commands?

Thanks!  
chirag

---

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [August 8, 2007, 11:11am UTC](https://www.ruby-forum.com/t/record-size-and-table-size-with-activerecord/111517/2 "2007-08-08T11:11:14Z")

</div>

chirag wrote:

> What is the best way to find the record size and table size in a  
> database using ActiveRecord? And will that method indicate actual disk  
> space?

Here’s something I use with MySQL:

def self.table\_size\_in\_bytes  
connection.select\_one(“show table status like  
‘#{table\_name}’”)[‘Data\_length’].to\_i  
end

–  
We develop, watch us RoR, in numbers too big to ignore.
