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
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
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