查看Size
函数名 | 返回类型 | 描述 |
pg_column_size(any) | int | 存储一个指定的数值需要的字节数(可能压缩过) |
pg_database_size(oid) | bigint | 指定OID的数据库使用的磁盘空间 |
pg_database_size(name) | bigint | 指定名称的数据库使用的磁盘空间 |
pg_indexes_size(regclass) | bigint | 关联指定表OID或表名的表索引的使用总磁盘空间 |
pg_relation_size(relation regclass,fork text) | bigint | 指定OID或名的表或索引,通过指定fork('main','fsm' 或'vm')所使用的磁盘空间 |
pg_relation_size(relation regclass) | bigint | pg_relation_size(...,'main')的缩写 |
pg_size_pretty(bigint) | text | Converts a size in bytes expressed as a 64-bit integer into a human-readable format with size units |
pg_size_pretty(numeric) | text | 把以字节计算的数值转换成一个人类易读的尺寸单位 |
pg_table_size(regclass) | bigint | 指定表OID或表名的表使用的磁盘空间,除去索引(但是包含TOAST,自由空间映射和可视映射) |
pg_tablespace_size(oid) | bigint | 指定OID的表空间使用的磁盘空间 |
pg_tablespace_size(name) | bigint | 指定名称的表空间使用的磁盘空间 |
pg_total_relation_size(regclass) | bigint | 指定表OID或表名使用的总磁盘空间,包括所有索引和TOAST数据 |
jsonandjsonbOperators
Operator | Right Operand Type | Description | Example | Example Result |
---|---|---|---|---|
-> | int | Get JSON array element (indexed from zero) | '[{"a":"foo"},{"b":"bar"},{"c":"baz"}]'::json->2 | {"c":"baz"} |
-> | text | Get JSON object field by key | '{"a": {"b":"foo"}}'::json->'a' | {"b":"foo"} |
->> | int | Get JSON array element astext | '[1,2,3]'::json->>2 | 3 |
->> | text | Get JSON object field astext | '{"a":1,"b":2}'::json->>'b' | 2 |
#> | text[] | Get JSON object at specified path | '{"a": {"b":{"c": "foo"}}}'::json#>'{a,b}' | {"c": "foo"} |
#>> | text[] | Get JSON object at specified path astext | '{"a":[1,3],"b":[4,5,6]}'::json#>>'{a,2}' | 3 |
AdditionaljsonbOperators
Operator | Right Operand Type | Description | Example |
---|---|---|---|
= | jsonb | Are the two JSON values equal? | '[1,3]'::jsonb = '[1,3]'::jsonb |
@> | jsonb | Does the left JSON value contain within it the right value? | '{"a":1,"b":2}'::jsonb @> '{"b":2}'::jsonb |
<@ | jsonb | Is the left JSON value contained within the right value? | '{"b":2}'::jsonb <@ '{"a":1,"b":2}'::jsonb |
? | text | Does the key/elementstringexist within the JSON value? | '{"a":1,"b":2}'::jsonb ? 'b' |
?| | text[] | Do any of these key/elementstringsexist? | '{"a":1,"b":2,"c":3}'::jsonb ?| array['b','c'] |
?& | text[] | Do all of these key/elementstringsexist? | '["a","b"]'::jsonb ?& array['a','b'] |