explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1l7A

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

HashAggregate (cost=21,667.56..21,668.64 rows=31 width=718) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=257.33..21,667.19 rows=37 width=718) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=123.35..10,408.08 rows=1 width=708) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=123.35..10,408.04 rows=1 width=708) (actual rows= loops=)

  • Join Filter: (dict.dict_allocation_reconstruction.allocation_id = th.th_rates.allocation)
  • Filter: (th.th_rates.visitdate >= COALESCE(dict.dict_allocation_reconstruction.date_recalculate, '1970-01-01'::date))
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=121.30..10,405.96 rows=1 width=708) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=121.30..10,397.26 rows=1 width=708) (actual rows= loops=)

  • Join Filter: (th.th_rates.recommendation = th.th_rates_recommendation.id)
7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=121.30..10,396.20 rows=1 width=708) (actual rows= loops=)

  • Join Filter: (th.th_rates.travel_company = th.th_rates_travel_company.id)
8. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on th_rates (cost=121.30..10,395.02 rows=1 width=708) (actual rows= loops=)

  • Recheck Cond: (allocation = 136675)
  • Filter: ((type <> 100) AND (COALESCE((travel_company)::integer, 0) <> 0) AND (((COALESCE(shady, false))::integer = 0) OR ((COALESCE(shady, false))::integer IS NULL)) AND (((in_hotel_confirmed)::integer IS NULL) OR ((in_hotel_confirmed)::integer = 1)) AND (type = ANY ('{0,2,3,9,12,13,14}'::integer[])))
9. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_th_rates_allocation_visitdate (cost=0.00..121.30 rows=2,707 width=0) (actual rows= loops=)

  • Index Cond: (allocation = 136675)
10. 0.000 0.000 ↓ 0.0

Seq Scan on th_rates_travel_company (cost=0.00..1.08 rows=8 width=2) (actual rows= loops=)

  • Filter: (NOT th.th_rates_travel_company.trash)
11. 0.000 0.000 ↓ 0.0

Seq Scan on th_rates_recommendation (cost=0.00..1.04 rows=1 width=2) (actual rows= loops=)

  • Filter: ((NOT th.th_rates_recommendation.trash) AND ("substring"((th.th_rates_recommendation.name)::text, 1, 1) = 'р'::text))
12. 0.000 0.000 ↓ 0.0

Index Scan using pk_th_user on th_user (cost=0.00..8.69 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (th.th_user.id = th.th_rates.th_user_id)
  • Filter: (th.th_user.trust <> 5)
13. 0.000 0.000 ↓ 0.0

Unique (cost=2.05..2.05 rows=1 width=12) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Sort (cost=2.05..2.05 rows=1 width=12) (actual rows= loops=)

  • Sort Key: dict.dict_allocation_reconstruction.date_reconstruction
15. 0.000 0.000 ↓ 0.0

Seq Scan on dict_allocation_reconstruction (cost=0.00..2.04 rows=1 width=12) (actual rows= loops=)

  • Filter: ((NOT trash) AND (date_reconstruction IS NOT NULL) AND (date_recalculate IS NOT NULL) AND (allocation_id = 136675))
16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=133.98..11,258.73 rows=37 width=710) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop (cost=133.98..10,823.70 rows=52 width=714) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Hash Join (cost=133.98..10,377.22 rows=52 width=710) (actual rows= loops=)

  • Hash Cond: (th.th_rates.travel_company = th.th_rates_travel_company.id)
19. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=131.65..10,373.93 rows=118 width=708) (actual rows= loops=)

  • Hash Cond: (th.th_rates.allocation = recalc2.allocation_id)
  • Filter: (th.th_rates.visitdate >= COALESCE(recalc2.date_recalculate, '1970-01-01'::date))
20. 0.000 0.000 ↓ 0.0

Hash Join (cost=129.57..10,366.10 rows=354 width=708) (actual rows= loops=)

  • Hash Cond: (th.th_rates.recommendation = th.th_rates_recommendation.id)
21. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on th_rates (cost=128.51..10,354.86 rows=1,772 width=708) (actual rows= loops=)

  • Recheck Cond: ((allocation > 0) AND (allocation = 136675))
  • Filter: ((type <> 100) AND (type = ANY ('{0,2,3,9,12,13,14}'::integer[])))
22. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_th_rates_allocation_visitdate (cost=0.00..128.07 rows=2,707 width=0) (actual rows= loops=)

  • Index Cond: ((allocation > 0) AND (allocation = 136675))
23. 0.000 0.000 ↓ 0.0

Hash (cost=1.04..1.04 rows=1 width=2) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Seq Scan on th_rates_recommendation (cost=0.00..1.04 rows=1 width=2) (actual rows= loops=)

  • Filter: ((NOT trash) AND ("substring"((name)::text, 1, 1) = 'р'::text))
25. 0.000 0.000 ↓ 0.0

Hash (cost=2.06..2.06 rows=1 width=8) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Subquery Scan on recalc2 (cost=2.05..2.06 rows=1 width=8) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Unique (cost=2.05..2.05 rows=1 width=12) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Sort (cost=2.05..2.05 rows=1 width=12) (actual rows= loops=)

  • Sort Key: dict.dict_allocation_reconstruction.date_reconstruction
29. 0.000 0.000 ↓ 0.0

Seq Scan on dict_allocation_reconstruction (cost=0.00..2.04 rows=1 width=12) (actual rows= loops=)

  • Filter: ((NOT trash) AND (date_reconstruction IS NOT NULL) AND (date_recalculate IS NOT NULL) AND (allocation_id = 136675))
30. 0.000 0.000 ↓ 0.0

Hash (cost=2.28..2.28 rows=4 width=4) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.13..2.28 rows=4 width=4) (actual rows= loops=)

  • Hash Cond: (th.th_rates_travel_company.group_id = th_rates_travel_company_group.id)
32. 0.000 0.000 ↓ 0.0

Seq Scan on th_rates_travel_company (cost=0.00..1.08 rows=8 width=4) (actual rows= loops=)

  • Filter: (NOT trash)
33. 0.000 0.000 ↓ 0.0

Hash (cost=1.08..1.08 rows=4 width=2) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Seq Scan on th_rates_travel_company_group (cost=0.00..1.08 rows=4 width=2) (actual rows= loops=)

  • Filter: (NOT trash)
35. 0.000 0.000 ↓ 0.0

Index Scan using pk_th_user_stat on th_user_stat (cost=0.00..8.57 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (th.th_user_stat.th_user_id = th.th_rates.th_user_id)
36. 0.000 0.000 ↓ 0.0

Index Scan using pk_th_user on th_user (cost=0.00..8.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (th.th_user.id = th.th_rates.th_user_id)
  • Filter: ((th.th_user.trust <> 5) AND ((th.th_user.active)::integer = 1))