Aggregate (cost=1929.69..1929.70 rows=1 width=8) |
-> Hash Left Join (cost=1845.03..1929.64 rows=20 width=0) |
Hash Cond: (c.id = sub_c.id) |
Filter: ((((date_part('epoch'::text, (CURRENT_TIMESTAMP - max(sl.end_at))) / '86400'::double precision)) > ((cc.notice_days - 1))::double precision) OR (((date_part('epoch'::text, (CURRENT_TIMESTAMP - max(sl.end_at))) / '86400'::double precision)) IS NULL)) |
-> Hash Left Join (cost=5.82..90.28 rows=59 width=6) |
Hash Cond: (c.client_class = cc.id) |
-> Bitmap Heap Scan on tbl_clients c (cost=4.73..88.93 rows=59 width=8) |
Recheck Cond: (sales_rep = 1001) |
Filter: (NOT deleted) |
-> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..4.72 rows=59 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) |
-> Hash (cost=1838.47..1838.47 rows=59 width=12) |
-> HashAggregate (cost=1836.70..1837.88 rows=59 width=12) |
Group Key: sub_c.id |
-> Hash Right Join (cost=89.67..1831.61 rows=1018 width=12) |
Hash Cond: (sl.client_id = sub_c.id) |
-> Seq Scan on tbl_work_logs sl (cost=0.00..1651.38 rows=34438 width=12) |
-> Hash (cost=88.93..88.93 rows=59 width=4) |
-> Bitmap Heap Scan on tbl_clients sub_c (cost=4.73..88.93 rows=59 width=4) |
Recheck Cond: (sales_rep = 1001) |
Filter: (NOT deleted) |
-> Bitmap Index Scan on tbl_clients_sales_rep_idx (cost=0.00..4.72 rows=59 width=0) |
Index Cond: (sales_rep = 1001) |