MDL-37527 Assignment - Change query for print_overview so it uses an index (postgres)