explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 215h

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

Aggregate (cost=33,944.44..33,944.45 rows=1 width=8) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.98..33,943.74 rows=283 width=4) (actual rows= loops=)

  • Join Filter: (c.time_zone_id = tz.id)
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.98..33,772.28 rows=283 width=8) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..33,684.50 rows=283 width=8) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..9,670.79 rows=567 width=12) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Seq Scan on service_data_consumption sdcd (cost=0.00..6,101.48 rows=579 width=4) (actual rows= loops=)

  • Filter: ((NOT deleted) AND ((end_date)::date >= ((date_trunc('month'::text, now()) - '11 mons'::interval))::date) AND ((end_date)::date <= ((date_trunc('month'::text, now()) + '3 mons'::interval))::date))
7. 0.000 0.000 ↓ 0.0

Index Scan using pk_consumption_entity_id on consumption_entity ce (cost=0.42..6.16 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = sdcd.consumption_entity_id)
  • Filter: ((NOT deleted) AND (NOT saved_as_draft) AND (client_id = 1005))
8. 0.000 0.000 ↓ 0.0

Index Only Scan using pk_contract_service_data on contract_service_data csd (cost=0.29..42.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = ce.service_id)
  • Filter: COALESCE(NULLIF((alternatives: SubPlan 1 or hashed SubPlan 2), false), NULLIF((alternatives: SubPlan 3 or hashed SubPlan 4), false), NULLIF((alternatives: SubPlan 5 or hashed SubPlan 6), false))
9.          

SubPlan (for Index Only Scan)

10. 0.000 0.000 ↓ 0.0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr (cost=0.43..8.45 rows=1 width=0) (actual rows= loops=)

  • Index Cond: ((user_id = 1251) AND (entity_type_id = 64) AND (entity_id = csd.id))
11. 0.000 0.000 ↓ 0.0

Index Scan using user_data_read_access_1 on user_data_read_access udr_1 (cost=0.43..378.07 rows=109 width=4) (actual rows= loops=)

  • Index Cond: ((user_id = 1251) AND (entity_type_id = 64))
12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..16.76 rows=1 width=0) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Index Scan using pk_contract_service_data on contract_service_data et (cost=0.29..8.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = csd.id)
14. 0.000 0.000 ↓ 0.0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_2 (cost=0.43..8.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((user_id = 1251) AND (entity_type_id = 61) AND (entity_id = et.contract_id))
15. 0.000 0.000 ↓ 0.0

Hash Join (cost=5,546.61..6,822.06 rows=6,198 width=4) (actual rows= loops=)

  • Hash Cond: (et_1.contract_id = udr_3.entity_id)
16. 0.000 0.000 ↓ 0.0

Seq Scan on contract_service_data et_1 (cost=0.00..1,017.41 rows=20,441 width=8) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash (cost=5,516.57..5,516.57 rows=2,403 width=4) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on user_data_read_access udr_3 (cost=53.06..5,516.57 rows=2,403 width=4) (actual rows= loops=)

  • Recheck Cond: ((user_id = 1251) AND (entity_type_id = 61))
19. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on user_data_read_access_1 (cost=0.00..52.46 rows=2,403 width=0) (actual rows= loops=)

  • Index Cond: ((user_id = 1251) AND (entity_type_id = 61))
20. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.71..16.80 rows=1 width=0) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Index Scan using pk_contract_service_data on contract_service_data et_2 (cost=0.29..8.30 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = csd.id)
22. 0.000 0.000 ↓ 0.0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_4 (cost=0.43..8.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((user_id = 1251) AND (entity_type_id = 1) AND (entity_id = et_2.relation_id))
23. 0.000 0.000 ↓ 0.0

Hash Join (cost=1,270.16..2,545.59 rows=2,159 width=4) (actual rows= loops=)

  • Hash Cond: (et_3.relation_id = udr_5.entity_id)
24. 0.000 0.000 ↓ 0.0

Seq Scan on contract_service_data et_3 (cost=0.00..1,017.41 rows=20,441 width=8) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Hash (cost=1,265.48..1,265.48 rows=374 width=4) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_5 (cost=0.43..1,265.48 rows=374 width=4) (actual rows= loops=)

  • Index Cond: ((user_id = 1251) AND (entity_type_id = 1))
27. 0.000 0.000 ↓ 0.0

Index Scan using pk_contract on contract c (cost=0.28..0.31 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = ce.contract_id)
28. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.62 rows=41 width=4) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Seq Scan on time_zone tz (cost=0.00..1.41 rows=41 width=4) (actual rows= loops=)