test=> CREATE TABLE t AS SELECT * FROM (SELECT generate_series(1,10000) AS a) q1, (SELECT generate_series(1,2) AS b) q2;
SELECT 20000
test=> CREATE INDEX i ON t (a);
CREATE INDEX
test=> EXPLAIN SELECT * FROM t ORDER BY a LIMIT 5;
Limit (cost=0.29..0.44 rows=5 width=8)
-> Index Scan using i on t (cost=0.29..620.29 rows=20000 width=8)
test=> EXPLAIN SELECT * FROM t ORDER BY a, b LIMIT 5;
Limit (cost=621.19..621.21 rows=5 width=8)
-> Sort (cost=621.19..671.19 rows=20000 width=8)
Sort Key: a, b
-> Seq Scan on t (cost=0.00..289.00 rows=20000 width=8)
Какого хуя?