-- 查看pg设置的最大连接数
show max_connections;
-- 查看当前连接数
select count(*) from pg_stat_activity;
-- 查看所有复制槽
select * from pg_replication_slots;
-- 删除某一复制槽 {your_slot_name}替换为要删除的复制槽名称
select pg_drop_replication_slot('{your_slot_name}');
-- 查询jsonb下一级字段
select jsonb->> 'fild1' from {your_schema}.{your_table};
-- 查询jsonb下一级的下一级(以此类推)
select jsonb -> 'metadata' ->> 'createdBy' from {your_schema}.{your_table};
-- 查询某一列的和
SELECT SUM(volume) AS totalCkoItems, SUM(person_times) AS totalCkoPeople
FROM {your_schema}.{your_table};
-- 建立索引(其实索引有很多种,值得拎出来单讲)
create index haiheng_uid_insert_fail_error_code_idx
on {your_table} (error_code);
postgresql常用指令(待补充。。。)
于 2024-08-02 09:43:20 首次发布