我有使用 Rails 3 + Postgresql 的多租户应用程序我想获取模式的大小..
在 size_cotroller.rb 上
class SizesController < ApplicationController
def index
@tablesize = ActiveRecord::Base.connection.select_rows(%q{select pg_size_pretty(CAST((SELECT SUM(pg_total_relation_size(table_schema || '.' || table_name) ) FROM information_schema.tables WHERE table_schema = 'schema2') As bigint) ) As schema_size})
end
end
但输出显示:
[[“264 KB”]]
如何取大小的值?
例子
264
任何的想法?