Jason Turner <lefticus(at)gmail(dot)com> writes:
> My initial guess is that it is not able to utilize the index on
> foo.tracktitle to sort the result set after foo has been joined with
> other tables.
Well, of course not. It should be able to do it before, though, and I'm
a bit surprised that you didn't get the same plan from both cases seeing
that the planner knows the first one is cheaper. Can you provide a
complete self-contained test case? I'm not interested in trying to
reverse-engineer your table definitions ...
regards, tom lane