Aggregate (cost=2053.81..2053.82 rows=1 width=8) |
-> HashAggregate (cost=2003.50..2034.46 rows=1548 width=22) |
Group Key: c.id, c.client_class, cc.notice_days, (date_part('epoch'::text, (now() - max(sl.end_at))) / '86400'::double precision) |
-> HashAggregate (cost=1957.06..1988.02 rows=1548 width=22) |
Group Key: c.id, cc.id |
Filter: ((date_part('epoch'::text, (now() - max(sl.end_at))) / '86400'::double precision) > (cc.notice_days)::double precision) |
-> Hash Left Join (cost=117.85..1888.84 rows=6822 width=22) |
Hash Cond: (c.client_class = cc.id) |
-> Hash Right Join (cost=116.76..1858.59 rows=6822 width=16) |
Hash Cond: (sl.client_id = c.id) |
-> Seq Scan on tbl_work_logs sl (cost=0.00..1651.38 rows=34393 width=12) |
Filter: (NOT is_draft) |
-> Hash (cost=111.92..111.92 rows=387 width=8) |
-> Bitmap Heap Scan on tbl_clients c (cost=20.12..111.92 rows=387 width=8) |
Recheck Cond: (sales_rep = ANY ('{1004,1005,1013,5087}'::integer[])) |
Filter: (NOT deleted) |
-> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..20.02 rows=387 width=0) |
Index Cond: (sales_rep = ANY ('{1004,1005,1013,5087}'::integer[])) |
-> Hash (cost=1.04..1.04 rows=4 width=6) |
-> Seq Scan on tbl_client_classes cc (cost=0.00..1.04 rows=4 width=6) |