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
–
We develop, watch us RoR, in numbers too big to ignore.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs