Database Development

Postgres query performance – hash aggregate costly operation

I’m running Postgres 9.6.6 and I have a relatively simple query, however, I’m finding that it is slow with the hash aggregation function which is the most costly operation: select program_schedule_source_count.full_name,, sum(program_schedule_source_count.displays) as displays, program_schedule_source_count.source_id, program_schedule_source_count.source_region from program_schedule_source_count where program_schedule_source_count.original_title = ‘How I Met Your Mother’ and program_schedule_source_count.show_type in (‘SM’, ‘SE’) and program_schedule_source_count.start_date between […]