explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3kL

Settings
# exclusive inclusive rows x rows loops node
1. 0.042 282.154 ↑ 1.0 1 1

Aggregate (cost=241,168.41..241,168.47 rows=1 width=448) (actual time=282.154..282.154 rows=1 loops=1)

2.          

CTE closed_checks

3. 11.107 209.096 ↓ 1.3 24,215 1

Hash Join (cost=327.51..239,690.44 rows=19,069 width=181) (actual time=2.288..209.096 rows=24,215 loops=1)

  • Hash Cond: (checks.employee_id = employees.id)
4. 19.590 195.771 ↓ 1.3 24,215 1

Nested Loop (cost=0.99..238,815.69 rows=19,069 width=189) (actual time=0.028..195.771 rows=24,215 loops=1)

5. 103.536 103.536 ↓ 1.3 24,215 1

Index Scan using index_checks_on_status_and_bd_and_pid_and_deleted_at on checks (cost=0.56..99,751.95 rows=19,069 width=32) (actual time=0.020..103.536 rows=24,215 loops=1)

  • Index Cond: ((status = ANY ('{0,1}'::integer[])) AND (business_date >= '2019-09-01'::date) AND (business_date <= '2019-12-02'::date) AND (property_id = '74d1ec69-29fb-4853-b241-93f6eca62286'::uuid) AND (deleted_at IS NULL))
6. 72.645 72.645 ↑ 1.0 1 24,215

Index Scan using index_check_summary_reports_on_check_id on check_summary_reports (cost=0.43..7.28 rows=1 width=173) (actual time=0.003..0.003 rows=1 loops=24,215)

  • Index Cond: (check_id = checks.id)
7. 0.896 2.218 ↑ 1.0 8,023 1

Hash (cost=226.23..226.23 rows=8,023 width=16) (actual time=2.218..2.218 rows=8,023 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 441kB
8. 1.322 1.322 ↑ 1.0 8,023 1

Seq Scan on employees (cost=0.00..226.23 rows=8,023 width=16) (actual time=0.006..1.322 rows=8,023 loops=1)

9.          

CTE report_data

10. 49.996 282.110 ↑ 1.0 1 1

Aggregate (cost=1,477.87..1,477.88 rows=1 width=320) (actual time=282.110..282.110 rows=1 loops=1)

11. 232.114 232.114 ↓ 1.3 24,215 1

CTE Scan on closed_checks (cost=0.00..381.38 rows=19,069 width=220) (actual time=2.294..232.114 rows=24,215 loops=1)

12. 282.112 282.112 ↑ 1.0 1 1

CTE Scan on report_data (cost=0.00..0.02 rows=1 width=320) (actual time=282.112..282.112 rows=1 loops=1)