随笔分类 - pgsql
pgsql语法
摘要:url: jdbc:postgresql://192.168.20.10:5432/库名称?reWriteBatchedInserts=true reWriteBatchedInserts=true;控制是否将批量插入语句转换成更高效的形式
阅读全文
摘要:select relname, pg_size_pretty(pg_relation_size(relid)) from pg_stat_user_tables where schemaname='public' order by pg_relation_size(relid) desc;
阅读全文
摘要:select * from pg_stat_activity where datname = 'datname' and waiting_reason = 'lock'; 根据查询结果中的pid值杀掉进程 select pg_terminate_backend(pid)
阅读全文
摘要:SELECT array_to_json(array_agg(row_to_json(sys_xzqh))) from sys_xzqh where xzqh like '%341126%'
阅读全文
摘要:-- sum() over(partition by ... order by ...)SELECT len/sum(len)over(partition by road_id) param from rs; -- min() over(partition by ... order by ...)S
阅读全文
摘要:SELECT len/sum(len)over(partition by road_id) param from road_jcpd_section
阅读全文
摘要:SELECT rl.road_code,string_agg(distinct rs.tech_level_label, ',') from road_lst rlleft join road_section rs on rl.id = rs.road_idwhere rs.tech_level_l
阅读全文
摘要:1、创建物化视图 CREATE MATERIALIZED VIEW "view_xxx“ as select * from 表 2、刷新物化视图 refresh materialized view view_xxx; 3、删除物化视图 drop materialized view view_xxx;
阅读全文