Instead of : > WHERE cd='ca' ORDER BY l_postcode; Write : > WHERE cd='ca' ORDER BY cd, l_postcode; You have a multicolumn index, so you should specify a multicolumn sort exactly the same as your index, and the planner will get it.
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных