explain.depesz.com

PostgreSQL's explain analyze made readable

Result: WwAS

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 0.072 ↑ 1.0 1 1

Nested Loop Left Join (cost=45.96..85.96 rows=1 width=373) (actual time=0.070..0.072 rows=1 loops=1)

2.          

Initplan (for Nested Loop Left Join)

3. 0.001 0.007 ↑ 1.0 1 1

Aggregate (cost=20.48..20.49 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=1)

4. 0.001 0.006 ↑ 2.0 1 1

Nested Loop (cost=0.69..20.48 rows=2 width=4) (actual time=0.005..0.006 rows=1 loops=1)

5. 0.003 0.003 ↑ 2.0 1 1

Index Scan using incidents_country_storekeeper_id_incident_state_id_rule_id_inde on incidents i_1 (cost=0.42..11.88 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (((country)::text = 'co'::text) AND (storekeeper_id = 50197) AND ((incident_state_id)::text = 'approved'::text))
6. 0.002 0.002 ↑ 1.0 1 1

Index Only Scan using rules_pkey on rules rul_2 (cost=0.27..4.29 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=1)

  • Index Cond: (id = i_1.rule_id)
  • Heap Fetches: 0
7. 0.000 0.033 ↑ 1.0 1 1

Nested Loop (cost=21.18..40.76 rows=1 width=321) (actual time=0.033..0.033 rows=1 loops=1)

8. 0.004 0.031 ↑ 1.0 1 1

Nested Loop Semi Join (cost=20.90..32.46 rows=1 width=208) (actual time=0.031..0.031 rows=1 loops=1)

  • Join Filter: (inc.id = i.id)
9. 0.008 0.008 ↑ 2.0 1 1

Index Scan using incidents_country_storekeeper_id_incident_state_id_rule_id_inde on incidents inc (cost=0.42..11.88 rows=2 width=208) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: (((country)::text = 'co'::text) AND (storekeeper_id = 50197) AND ((incident_state_id)::text = 'approved'::text))
10. 0.002 0.019 ↑ 2.0 1 1

Materialize (cost=20.49..20.52 rows=2 width=4) (actual time=0.019..0.019 rows=1 loops=1)

11. 0.001 0.017 ↑ 2.0 1 1

Limit (cost=20.49..20.49 rows=2 width=4) (actual time=0.017..0.017 rows=1 loops=1)

12. 0.008 0.016 ↑ 2.0 1 1

Sort (cost=20.49..20.49 rows=2 width=4) (actual time=0.016..0.016 rows=1 loops=1)

  • Sort Key: i.id DESC
  • Sort Method: quicksort Memory: 25kB
13. 0.002 0.008 ↑ 2.0 1 1

Nested Loop (cost=0.69..20.48 rows=2 width=4) (actual time=0.007..0.008 rows=1 loops=1)

14. 0.003 0.003 ↑ 2.0 1 1

Index Scan using incidents_country_storekeeper_id_incident_state_id_rule_id_inde on incidents i (cost=0.42..11.88 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (((country)::text = 'co'::text) AND (storekeeper_id = 50197) AND ((incident_state_id)::text = 'approved'::text))
15. 0.003 0.003 ↑ 1.0 1 1

Index Only Scan using rules_pkey on rules rul_1 (cost=0.27..4.29 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=1)

  • Index Cond: (id = i.rule_id)
  • Heap Fetches: 0
16. 0.002 0.002 ↑ 1.0 1 1

Index Scan using rules_pkey on rules rul (cost=0.27..8.29 rows=1 width=117) (actual time=0.002..0.002 rows=1 loops=1)

  • Index Cond: (id = inc.rule_id)
17. 0.008 0.016 ↑ 1.0 1 1

Bitmap Heap Scan on rule_exception re (cost=4.29..8.08 rows=1 width=6) (actual time=0.014..0.016 rows=1 loops=1)

  • Recheck Cond: (rule_id = inc.rule_id)
  • Filter: (is_active AND (rule_exception_id = 3))
  • Rows Removed by Filter: 2
  • Heap Blocks: exact=2
18. 0.008 0.008 ↓ 1.5 3 1

Bitmap Index Scan on rule_exception_rule_id_index (cost=0.00..4.29 rows=2 width=0) (actual time=0.008..0.008 rows=3 loops=1)

  • Index Cond: (rule_id = inc.rule_id)
19.          

SubPlan (for Nested Loop Left Join)

20. 0.003 0.006 ↓ 0.0 0 1

Limit (cost=0.28..8.30 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=1)

21. 0.003 0.003 ↓ 0.0 0 1

Index Only Scan Backward using incident_modifications_incident_id_new_state_created_at_index on incident_modifications (cost=0.28..8.30 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: ((incident_id = inc.id) AND (new_state = 'notified'::text))
  • Heap Fetches: 0
22. 0.001 0.002 ↑ 1.0 1 1

Aggregate (cost=8.31..8.32 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=1)

23. 0.001 0.001 ↓ 0.0 0 1

Index Scan using incident_modifications_incident_id_new_state_created_at_index on incident_modifications im (cost=0.28..8.29 rows=1 width=206) (actual time=0.001..0.001 rows=0 loops=1)

  • Index Cond: (incident_id = inc.id)
Planning time : 0.907 ms
Execution time : 0.309 ms