explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6Q9W

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 0.077 ↓ 2.0 2 1

Sort (cost=53.08..53.08 rows=1 width=47) (actual time=0.077..0.077 rows=2 loops=1)

  • Sort Key: cf.created_at
  • Sort Method: quicksort Memory: 25kB
2. 0.005 0.072 ↓ 2.0 2 1

Nested Loop (cost=1.82..53.07 rows=1 width=47) (actual time=0.055..0.072 rows=2 loops=1)

  • Join Filter: (cf.id = investigation.case_id)
3. 0.004 0.061 ↓ 2.0 2 1

Nested Loop (cost=1.54..51.70 rows=1 width=50) (actual time=0.050..0.061 rows=2 loops=1)

  • Join Filter: (toxicology_request.no_external_toxicology_required OR (SubPlan 1))
4. 0.007 0.030 ↑ 4.0 3 1

Hash Join (cost=1.27..22.92 rows=12 width=17) (actual time=0.026..0.030 rows=3 loops=1)

  • Hash Cond: (internal_toxicology_study.case_id = toxicology_request.case_id)
5. 0.010 0.010 ↑ 278.7 3 1

Seq Scan on internal_toxicology_study (cost=0.00..18.40 rows=836 width=8) (actual time=0.007..0.010 rows=3 loops=1)

  • Filter: (completed_at IS NOT NULL)
6. 0.005 0.013 ↑ 1.0 12 1

Hash (cost=1.12..1.12 rows=12 width=9) (actual time=0.013..0.013 rows=12 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
7. 0.008 0.008 ↑ 1.0 12 1

Seq Scan on toxicology_request (cost=0.00..1.12 rows=12 width=9) (actual time=0.005..0.008 rows=12 loops=1)

8. 0.012 0.012 ↑ 1.0 1 3

Index Scan using case_file_pkey on case_file cf (cost=0.28..1.28 rows=1 width=34) (actual time=0.004..0.004 rows=1 loops=3)

  • Index Cond: (id = internal_toxicology_study.case_id)
  • Filter: (require_toxicology AND (NOT toxicology_complete))
  • Rows Removed by Filter: 0
9.          

SubPlan (forNested Loop)

10. 0.001 0.015 ↑ 1.0 1 1

Unique (cost=1.10..1.10 rows=1 width=1) (actual time=0.014..0.015 rows=1 loops=1)

11. 0.005 0.014 ↓ 2.0 2 1

Sort (cost=1.10..1.10 rows=1 width=1) (actual time=0.014..0.014 rows=2 loops=1)

  • Sort Key: external_toxicology_study.complete
  • Sort Method: quicksort Memory: 25kB
12. 0.009 0.009 ↓ 2.0 2 1

Seq Scan on external_toxicology_study (cost=0.00..1.09 rows=1 width=1) (actual time=0.005..0.009 rows=2 loops=1)

  • Filter: ((NOT destroyed) AND (case_id = cf.id))
  • Rows Removed by Filter: 8
13. 0.006 0.006 ↑ 1.0 1 2

Index Scan using idx_investigation_investigation_case on investigation (cost=0.28..1.35 rows=1 width=21) (actual time=0.002..0.003 rows=1 loops=2)

  • Index Cond: (case_id = internal_toxicology_study.case_id)
Planning time : 1.159 ms
Execution time : 0.138 ms