Hi, Your user could enter data freely or from popup menu by example ? By my few knowledge, maybe, there no low cost ( number of queries ) solution ... Tell ( of force ) your user to add condition step by step if there is too many results, no why?
pgsql-php by date:
Соглашаюсь с условиями обработки персональных данных