PostgreSQL: How to force db use the "quicksort" sorting method instead of "top-N heapsort"?

1.6k views Asked by At

Actually, all my question is written in subj-field. It's it somehow possible in PostgreSQL? Probably at server-config level, or can be configured in query, or in properties of table? I hardly tried to google for it, but got no result. So your help would be very appreciated (even pointing me to google with correct query, if i'm mistaken. Thanks beforehand.

1

There are 1 answers

0
Denis de Bernardy On

You cannot. The planner will pick the more appropriate method based on what you're doing:

  • top-n sort if you've an order by / limit with a reasonably small number;
  • quick sort (in memory or on disk) if not.