Arup Rakshit <ar@xxxxxxx> writes: > My query is not using name index to sort the result. Given the rowcounts here, I think the planner is making the right choice. Sorting 70-some rows with a Sort node is probably cheaper than doing random disk I/O to get them in sorted order. With more rows involved, it might make the other choice. As a testing measure (don't do it in production!), you could set enable_sort = off, which will force the planner to pick a non-Sort plan if possible. Then you could see whether that's actually faster or slower, and by how much. regards, tom lane