| Aggregate (cost=1903.00..1903.01 rows=1 width=8) |
| -> Unique (cost=1897.20..1900.10 rows=232 width=22) |
| -> Sort (cost=1897.20..1897.78 rows=232 width=22) |
| Sort Key: c.id, c.client_class, cc.notice_days, ((date_part('epoch'::text, (now() - max(sl.end_at))) / '86400'::double precision)) |
| -> HashAggregate (cost=1883.45..1888.09 rows=232 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=96.71..1873.09 rows=1036 width=22) |
| Hash Cond: (c.client_class = cc.id) |
| -> Hash Right Join (cost=95.62..1867.83 rows=1036 width=16) |
| Hash Cond: (sl.client_id = c.id) |
| -> Seq Scan on tbl_work_logs sl (cost=0.00..1680.24 rows=34975 width=12) |
| Filter: (NOT is_draft) |
| -> Hash (cost=94.89..94.89 rows=58 width=8) |
| -> Bitmap Heap Scan on tbl_clients c (cost=4.73..94.89 rows=58 width=8) |
| Recheck Cond: (sales_rep = 1001) |
| Filter: (NOT deleted) |
| -> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..4.71 rows=58 width=0) |
| Index Cond: (sales_rep = 1001) |
| -> 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) |