Pro váš dotaz chcete index na xml_files("purchaseNumber", "docPublishDate" desc) :
create index idx_xml_files_2 on xml_files("purchaseNumber", "docPublishDate" desc)
Postgres by měl tento index použít pro order by , což usnadňuje distinct on .
I když to neovlivní výkon, doporučil bych také zjednodušit where doložka k:
where parsing_status IS NULL