发布时间:2025-11-04 06:48:31 来源:技术快报 作者:域名

聚集函数
复制select string_agg(c_name,新功选都,) as name from customer group by c_phone; select c_custkey,group_concat(c_name order by c_name desc ) from customer group by c_custkey;1.2.聚集函数 + 过滤
复制select string_agg(c_name,,) filter (where c_name like ABC%) as name from customer group by c_phone; select count(1) filter (where c_name like ABC%) from customer group by c_phone;1.2.窗口函数
复制select *, row_number() over (partition by o_custkey order by o_orderkey desc) as rank from orders where o_orderdate = 2022-01-01; select string_agg(c_name,,) over (partition by c_phone) as name from customer; -- rows/range select string_agg(c_name,,) filter (where c_name like ABC%) over(partition by c_phone order by c_name ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) as name from customer; -- exclude select string_agg(c_name,,) over(partition by c_phone order by c_name ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE TIES) as name from customer;1.2.3.4.5.6.7.8.9.窗口函数 + 过滤
复制select string_agg(c_name,,) filter (where c_name like ABC%) over(partition by c_phone) as name from customer; select *, row_number() filter (where c_name like ABC%) over (partition by o_custkey order by o_orderkey desc) as rank from orders where o_orderdate = 2022-01-01;1.2.WITHIN函数
复制select string_agg(c_name,,) within group(order by c_custkey) over(partition by c_phone) name from customer; SELECT percentile_cont(0.5) WITHIN GROUP (ORDER BY o.o_totalprice) FROM orders o group by o_custkey;1.2.支持表函数
复制SELECT * FROM generate_series(1, 10 ) AS t (n); SELECT * FROM customer c, (VALUES( 1 ,2), (3, 4)) AS t(a, b) WHERE t.a = c.c_current_addr_sk AND c.c_customer_sk > t.b;1.2.3.PawSQL识别两种语法解析错误,并在结果中提示用户,知道以便用户修正自己的新功选都SQL。
语法解析错误


PawSQL专注数据库性能优化的自动化和智能化,支持MySQL,PostgreSQL,Opengauss等,提供的SQL优化产品包括。
PawSQL Cloud,在线自动化SQL优化工具,支持SQL审查,智能查询重写、服务器租用基于代价的索引推荐,适用于数据库管理员及数据应用开发人员。PawSQL Advisor,IntelliJ 插件, 适用于数据应用开发人员,可以IDEA/DataGrip应用市场通过名称搜索“PawSQL Advisor”安装。PawSQL Engine, 是PawSQL系列产品的后端优化引擎,可以独立安装部署,并通过http/json的接口提供SQL优化服务。PawSQL Engine以docker镜像的方式提供部署安装。