Order by ...upper(xyz), do you have functional index on these ?
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных