如何恢复到pg_size_prettyPostgreSQL 中生成的原始值。
SELECT
c.relname
,pg_size_pretty (pg_relation_size (c.oid))
FROM pg_class c
ORDER BY c.relpages DESC
LIMIT 1;
RESULT:
relname | pg_size_pretty
------------------------
tabla | 928 MB
Run Code Online (Sandbox Code Playgroud)
我需要:928 MB > 973078528
此内置函数pg_size_bytes(text)从 9.6 开始可用。
postgres=# --
select
pg_size_pretty(973078528::bigint),
pg_size_bytes('928 MB'),
(pg_size_bytes('928 MB') > 973078528)::text as "is_bigger"
;
pg_size_pretty | pg_size_bytes | is_bigger
----------------+---------------+-----------
928 MB | 973078528 | false
(1 row)
postgres=#
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1841 次 |
| 最近记录: |