hi
one more question (maybe a dumb one....)
drop table if exists t1;
CREATE TABLE t1 AS
SELECT (i % 10)::numeric AS x,(i % 10)::int8 AS y,'abc' || i % 10 AS
z, i::int4 AS w
FROM generate_series(1, 100) AS i;
CREATE INDEX t1_x_y_idx ON t1 (x, y);
ANALYZE t1;
SET enable_hashagg = off;
SET enable_seqscan = off;
EXPLAIN (COSTS OFF, verbose) SELECT count(*) FROM t1 GROUP BY z,x,y,w
order by w;
QUERY PLAN
------------------------------------------------------
GroupAggregate
Output: count(*), w, z, x, y
Group Key: t1.w, t1.x, t1.y, t1.z
-> Sort
Output: w, z, x, y
Sort Key: t1.w, t1.x, t1.y, t1.z
-> Index Scan using t1_x_y_idx on public.t1
Output: w, z, x, y
(8 rows)
if you do
` Sort Key: t1.w, t1.x, t1.y, t1.z`
then the output is supposed to be:
Output: w, x, y, z
?