explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5gcF

Settings
# exclusive inclusive rows x rows loops node
1. 403.559 2,008.747 ↑ 1.0 1 1

Aggregate (cost=17,240,886.45..17,240,886.46 rows=1 width=8) (actual time=2,008.747..2,008.747 rows=1 loops=1)

2. 1,573.936 1,605.188 ↓ 2.0 2,473,416 1

Seq Scan on consumption_entity ce (cost=0.00..17,237,800.50 rows=1,234,380 width=4) (actual time=42.027..1,605.188 rows=2,473,416 loops=1)

  • Filter: ((NOT deleted) AND (NOT saved_as_draft) AND (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: 13126
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.192 0.192 ↓ 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.020..0.192 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. 12.013 31.060 ↓ 2.9 33,594 1

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

  • Merge Cond: (et_1.contract_id = udr_3.entity_id)
10. 17.693 17.693 ↑ 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.008..17.693 rows=38,371 loops=1)

11. 1.354 1.354 ↑ 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.020..1.354 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