Postgresql Postgres如何实现多维数据集、汇总集和分组集操作符
我感兴趣的是Postgres如何实现多维数据集、汇总集和分组集操作符?该实现基于处理排序数据。您可以看到EXPLAIN语句的结果:Postgresql Postgres如何实现多维数据集、汇总集和分组集操作符,postgresql,set,grouping,cube,rollup,Postgresql,Set,Grouping,Cube,Rollup,我感兴趣的是Postgres如何实现多维数据集、汇总集和分组集操作符?该实现基于处理排序数据。您可以看到EXPLAIN语句的结果: postgres=# EXPLAIN SELECT a, b, sum(c) FROM foo GROUP BY ROLLUP(a,b); ┌────────────────────────────────────────────────────────────────────┐ │ QUERY PLAN
postgres=# EXPLAIN SELECT a, b, sum(c) FROM foo GROUP BY ROLLUP(a,b);
┌────────────────────────────────────────────────────────────────────┐
│ QUERY PLAN │
╞════════════════════════════════════════════════════════════════════╡
│ GroupAggregate (cost=142.54..166.99 rows=405 width=12) │
│ Group Key: a, b │
│ Group Key: a │
│ Group Key: () │
│ -> Sort (cost=142.54..147.64 rows=2040 width=12) │
│ Sort Key: a, b │
│ -> Seq Scan on foo (cost=0.00..30.40 rows=2040 width=12) │
└────────────────────────────────────────────────────────────────────┘
(7 rows)
postgres=# EXPLAIN SELECT a, b, sum(c) FROM foo GROUP BY CUBE(a,b);
┌────────────────────────────────────────────────────────────────────┐
│ QUERY PLAN │
╞════════════════════════════════════════════════════════════════════╡
│ GroupAggregate (cost=142.54..302.48 rows=605 width=12) │
│ Group Key: a, b │
│ Group Key: a │
│ Group Key: () │
│ Sort Key: b │
│ Group Key: b │
│ -> Sort (cost=142.54..147.64 rows=2040 width=12) │
│ Sort Key: a, b │
│ -> Seq Scan on foo (cost=0.00..30.40 rows=2040 width=12) │
└────────────────────────────────────────────────────────────────────┘
(9 rows)
对数据进行排序,然后持续聚合 你的问题到底是什么?Postgres还不支持这一点。即将发布的9.5版(目前为beta版)将有:错误:postgres 9.3.16版不存在函数汇总(文本)@RizwanPatel-当然-PostgreSQL 9.5及更高版本支持它