> Any hint? you can run an explain analyze to check what is going on, when you provide a table in query in the order by clause, it is ordered by cols of that table in that order. create table t(id int, value int); postgres=# explain (analyze,verbose) select * from t order by t; QUERY PLAN ------------------------------------------------------------------------------------------------------------- Sort (cost=158.51..164.16 rows=2260 width=40) (actual time=0.005..0.006 rows=0 loops=1) Output: id, value, t.* Sort Key: t.* Sort Method: quicksort Memory: 25kB -> Seq Scan on public.t (cost=0.00..32.60 rows=2260 width=40) (actual time=0.002..0.002 rows=0 loops=1) Output: id, value, t.* Planning Time: 0.033 ms Execution Time: 0.044 ms (8 rows) postgres=# truncate table t; TRUNCATE TABLE postgres=# insert into t values (100, 1); INSERT 0 1 postgres=# insert into t values (50, 2); INSERT 0 1 postgres=# select * from t order by t; id | value -----+------- 50 | 2 100 | 1 (2 rows) postgres=# select * from t order by t.id, t.value; id | value -----+------- 50 | 2 100 | 1 (2 rows)