explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nKy

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Nested Loop (cost=13.62..6,077.58 rows=1 width=677) (actual rows= loops=)

  • Join Filter: (p.permitownerorganisationid = org.id)
2.          

Initplan (for Nested Loop)

3. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeAssesmentPeriodEnds'::text)
4. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_1 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeDecisionPeriodEnds'::text)
5. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_2 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeValidityPeriodEnds'::text)
6. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_3 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeAssesmentPeriodEnds'::text)
7. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_4 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeDecisionPeriodEnds'::text)
8. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_5 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeValidityPeriodEnds'::text)
9. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_6 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeAssesmentPeriodEnds'::text)
10. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_7 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeDecisionPeriodEnds'::text)
11. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_8 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeValidityPeriodEnds'::text)
12. 0.000 0.000 ↓ 0.0

Seq Scan on emailnotificationtype emailnotificationtype_9 (cost=0.00..1.16 rows=1 width=4) (actual rows= loops=)

  • Filter: ((name)::text = 'RemBeforeValidityPeriodEnds'::text)
13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.71..6,065.25 rows=1 width=681) (actual rows= loops=)

  • Join Filter: ((pr.permitid = p.id) AND (usr.organisationid = p.permitownerorganisationid))
14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.29..5,793.74 rows=3 width=12) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.00..5,791.91 rows=4 width=49) (actual rows= loops=)

  • Join Filter: (usr.id = un.userid)
16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..5,776.18 rows=49 width=57) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..5,740.68 rows=111 width=12) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on permitreminder pr (cost=0.00..4,807.81 rows=101 width=4) (actual rows= loops=)

  • Filter: (CASE WHEN (2 = $0) THEN isreminderonassignment WHEN (2 = $1) THEN isreminderondecision WHEN (2 = $2) THEN isreminderonexecution ELSE NULL::boolean END AND (NOT CASE WHEN (4 = $3) THEN COALESCE(isassignmentremindermailsent, false) WHEN (4 = $4) THEN COALESCE(isdecisionremindermailsent, false) WHEN (4 = $5) THEN COALESCE(isexecutionremindermailsent, false) ELSE NULL::boolean END) AND (to_char(now(), 'DDmmYYYY'::text) = CASE WHEN (4 = $6) THEN to_char(assignmentreminderduedate, 'DDmmYYYY'::text) WHEN (4 = $7) THEN to_char(decisionreminderduedate, 'DDmmYYYY'::text) WHEN (4 = $8) THEN to_char(executionreminderduedate, 'DDmmYYYY'::text) ELSE NULL::text END))
19. 0.000 0.000 ↓ 0.0

Index Scan using ix_permithistory_permitid on permithistory ph (cost=0.42..9.23 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (permitid = pr.permitid)
  • Filter: (permitstatustypeid = 4)
20. 0.000 0.000 ↓ 0.0

Index Scan using pk_user on "user" usr (cost=0.29..0.32 rows=1 width=45) (actual rows= loops=)

  • Index Cond: (id = ph.userid)
  • Filter: (NOT isdeleted)
21. 0.000 0.000 ↓ 0.0

Index Only Scan using user_id_emailnotificationtype_id_unique on useremailnotificationpermission un (cost=0.29..0.31 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((userid = ph.userid) AND (emailnotificationtypeid = 4))
22. 0.000 0.000 ↓ 0.0

Index Scan using pk_users on users mem (cost=0.29..0.46 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (user_id = (usr.aspmembershipid)::uuid)
  • Filter: approved
23. 0.000 0.000 ↓ 0.0

Index Scan using pk_permit on permit p (cost=0.42..90.49 rows=1 width=677) (actual rows= loops=)

  • Index Cond: (id = ph.permitid)
  • Filter: ((permitstatustypeid = 4) AND (0 = CASE WHEN (2 = $9) THEN (SubPlan 11) ELSE '0'::bigint END))
24.          

SubPlan (for Index Scan)

25. 0.000 0.000 ↓ 0.0

Aggregate (cost=89.81..89.82 rows=1 width=8) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Index Scan using ix_roadworkrequest_permitid on roadworkrequest rr (cost=0.43..89.68 rows=51 width=4) (actual rows= loops=)

  • Index Cond: (permitid = p.id)
27. 0.000 0.000 ↓ 0.0

Index Scan using pk_organisation on organisation org (cost=0.28..0.70 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = usr.organisationid)" Filter: emailenabled