Improving sort performance in PostgreSQL