Group¶
名称¶
分组算子
介绍¶
对已经排好序的数据进行分组操作
说明¶
--清理环境
DROP TABLE t1 CASCADE;
--创建环境
CREATE TABLE t1(a int);
INSERT INTO t1 SELECT generate_series(1,10);
ANALYZE t1;
EXPLAIN ANALYZE SELECT a FROM t1 GROUP BY a ORDER BY a;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Group (cost=7.27..7.32 rows=10 width=4) (actual time=0.05..0.06 rows=10 loops=1)
Group Key: A
-> Sort (cost=7.27..7.29 rows=10 width=4) (actual time=0.05..0.05 rows=10 loops=1)
Sort Key: A
Sort Method: quicksort Memory: 2kB
-> Seq Scan on T1 (cost=0.00..7.10 rows=10 width=4) (actual time=0.02..0.03 rows=10 loops=1)
Planning Time: 0.12 msec
Execution Time: 0.46 msec
(8 rows)