2010/8/12 PostgreSQL - Hans-Jürgen Schönig <postg...@cybertec.at>: > as tom pointed out - this is not possible. > there is no limit 20 in my case - i just used it to indicate that limiting > does not make the index scan possible which it does in some other cases.
I came up with this: explain analyze select * from (select * from t_test order by x limit all)s order by x, y limit 20; which uses index scan for column x and top-N heapsort for outer ORDER BY, though it's slower than "ORDER BY x LIMIT 20" case. If it chooses external sort for "ORDER BY x, y" LIMIT ALL likely wins while looses if quicksort is chosen. Regards, -- Hitoshi Harada -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers