explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DJmZ

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

Sort (cost=163.71..163.72 rows=1 width=47) (actual time=0.085..0.086 rows=2 loops=1)

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

Nested Loop (cost=0.84..163.70 rows=1 width=47) (actual time=0.060..0.081 rows=2 loops=1)

  • Join Filter: (toxicology_request.no_external_toxicology_required OR (SubPlan 1))
3. 0.001 0.030 ↑ 3.3 3 1

Nested Loop (cost=0.56..70.82 rows=10 width=38) (actual time=0.013..0.030 rows=3 loops=1)

4. 0.004 0.023 ↑ 4.0 3 1

Nested Loop (cost=0.29..54.44 rows=12 width=17) (actual time=0.010..0.023 rows=3 loops=1)

5. 0.007 0.007 ↑ 1.0 12 1

Index Scan using unique_toxicology_request_case_id on toxicology_request (cost=0.14..12.31 rows=12 width=9) (actual time=0.002..0.007 rows=12 loops=1)

6. 0.012 0.012 ↓ 0.0 0 12

Index Scan using unique_internal_toxicology_study_case_id on internal_toxicology_study (cost=0.15..3.50 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=12)

  • Index Cond: (case_id = toxicology_request.case_id)
  • Filter: (completed_at IS NOT NULL)
7. 0.006 0.006 ↑ 1.0 1 3

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

  • Index Cond: (case_id = internal_toxicology_study.case_id)
8. 0.006 0.006 ↑ 1.0 1 3

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

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

SubPlan (forNested Loop)

10. 0.003 0.044 ↑ 1.0 1 1

Unique (cost=8.16..8.17 rows=1 width=1) (actual time=0.043..0.044 rows=1 loops=1)

11. 0.005 0.041 ↓ 2.0 2 1

Sort (cost=8.16..8.17 rows=1 width=1) (actual time=0.041..0.041 rows=2 loops=1)

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

Index Scan using idx_external_toxicology_study_case_file on external_toxicology_study (cost=0.13..8.15 rows=1 width=1) (actual time=0.036..0.036 rows=2 loops=1)

  • Index Cond: (case_id = cf.id)
  • Filter: (NOT destroyed)
Planning time : 0.666 ms
Execution time : 0.120 ms