>> select advert_id from acr_cache where category_id = ? and region_id = ? >> order by category_id, region_id, XXX limit 20; don't forget to mention all the index columns in the order by, or the planner won't use it.
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных