explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qMgv

Settings
# exclusive inclusive rows x rows loops node
1. 411.590 1,708.099 ↑ 1.0 1 1

Aggregate (cost=17,240,908.70..17,240,908.71 rows=1 width=8) (actual time=1,708.099..1,708.099 rows=1 loops=1)

2. 1,261.087 1,296.509 ↓ 2.0 2,486,408 1

Seq Scan on consumption_entity ce (cost=0.00..17,237,800.50 rows=1,243,280 width=4) (actual time=47.936..1,296.509 rows=2,486,408 loops=1)

  • Filter: ((client_id = 1007) AND COALESCE(NULLIF((alternatives: SubPlan 1 or hashed SubPlan 2), false), NULLIF((alternatives: SubPlan 3 or hashed SubPlan 4), false), NULLIF((SubPlan 5), false)))
  • Rows Removed by Filter: 134
3.          

SubPlan (forSeq Scan)

4. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr (cost=0.57..1.70 rows=1 width=0) (never executed)

  • Index Cond: ((user_id = 1466) AND (entity_type_id = 64) AND (entity_id = ce.service_id))
  • Heap Fetches: 0
5. 0.317 0.317 ↓ 1.1 800 1

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_1 (cost=0.57..18.57 rows=735 width=4) (actual time=0.028..0.317 rows=800 loops=1)

  • Index Cond: ((user_id = 1466) AND (entity_type_id = 64))
  • Heap Fetches: 0
6. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..4.20 rows=1 width=0) (never executed)

7. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contract_service_data on contract_service_data et (cost=0.29..2.51 rows=1 width=4) (never executed)

  • Index Cond: (id = ce.service_id)
8. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_2 (cost=0.57..1.70 rows=1 width=4) (never executed)

  • Index Cond: ((user_id = 1466) AND (entity_type_id = 61) AND (entity_id = et.contract_id))
  • Heap Fetches: 0
9. 13.496 35.105 ↓ 2.9 33,594 1

Merge Join (cost=1.18..2,297.29 rows=11,528 width=4) (actual time=0.855..35.105 rows=33,594 loops=1)

  • Merge Cond: (et_1.contract_id = udr_3.entity_id)
10. 20.016 20.016 ↑ 1.0 38,371 1

Index Scan using idx_contract_service_data_2 on contract_service_data et_1 (cost=0.29..2,074.28 rows=38,371 width=8) (actual time=0.012..20.016 rows=38,371 loops=1)

11. 1.593 1.593 ↑ 1.7 6,449 1

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_3 (cost=0.57..273.41 rows=11,222 width=4) (actual time=0.027..1.593 rows=6,449 loops=1)

  • Index Cond: ((user_id = 1466) AND (entity_type_id = 61))
  • Heap Fetches: 0
12. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..3.15 rows=18 width=0) (never executed)

13. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contract_service_data on contract_service_data et_2 (cost=0.29..2.51 rows=1 width=4) (never executed)

  • Index Cond: (id = ce.service_id)
14. 0.000 0.000 ↓ 0.0 0

Index Only Scan using user_data_read_access_uk1 on user_data_read_access udr_4 (cost=0.57..1.86 rows=18 width=4) (never executed)

  • Index Cond: ((user_id = 1466) AND (entity_type_id = 1) AND (entity_id = et_2.relation_id))
  • Heap Fetches: 0