let PostgreSQL do most of the work