postgresql语句
2024-09-22 00:12:00
查询oracle数据库所有表数据量
select t.table_name,t.num_rows from user_tables t ORDER BY t.num_rows desc
查询postgresql数据库所有表数据量
select table_schema || '.' || table_name as table_full_name,
pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')) as size
from information_schema.tables
order by
pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') desc
改变配置
pg_ctl reload
分组取前几条:
https://blog.csdn.net/a258831020/article/details/48497929
select t.* from (select serial_group_id, total,year, month, row_number() over(partition by serial_group_id ORDER BY year desc,month desc) as row from ap_serial_group_sales ORDER BY year desc) t where row<=1
相加:
(coalesce(t.local_price,0)+coalesce(t.manu_price,0)+coalesce(t.country_price,0)) btotal
逗号合并:
select array_to_string(ARRAY(SELECT unnest(array_agg(t.id)) ),',') from ( select n.id from ap_group_photo_node n left join ap_group_photo_node_ex ex on ex.group_photo_node_id = n.id left join ap_photo p on n.id = p.group_photo_node_id where n.enabled = 1 and n.deleted = 0 and n.photo_amount > 0 and p.enabled=1 group by n.id order by n.id limit 100 ) t
相同id的合并值:
https://my.oschina.net/Kenyon/blog/86609
最新文章
- MongoDB数据库的CURD的一些基本语句
- 第 21 章 CSS3 文本效果
- golang笔记——命令
- 实现自己的js框架
- 1小时vpn coding让开发更简单 或https://www.imfreevpn.org/
- 【BZOJ】【1018】【SHOI2008】堵塞的交通traffic
- 在CentOS 5.8上搭建PPTP VPN服务
- Android(java)学习笔记99:android的短信发送器研究
- MySql的安装与使用
- .NET Mvc Razor
- 关于Java中面向对象章节、IO 流中的重点基础知识。
- http://codeforces.com/contest/838/problem/A
- springboot注解使用说明
- java之jsp内置对象
- 图像检索(4):IF-IDF,RootSift,VLAD
- 时间字符串格式化 js
- Confluence 6 你模板中可用的对象
- jquery绑定回车事件
- 黑马java课程2222
- php获取POST数据的三种方法
热门文章
- 手机Soc芯片简介
- Mina的IoBuffer改造成Netty的ByteBuff
- C#基础第六天
- 【公众号系列】两分钟学会SAP F1技巧
- UITableView编辑模式大全解
- windows下scrapy安装问题,以及Twisted安装报错(error: Microsoft Visual C++ 14.0 is required.)完美解决办法
- AD域安装及必要设置
- 用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列。
- 全民抵制“辱华”品牌秀,D&;G神回复:呵呵~ 那不是我!
- websocket 实现单聊群聊 以及 握手原理+加密方式