explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YnkJ

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

Seq Scan on bs_requests orig_r (cost=0.00..1,069,330,294.88 rows=3,706 width=28) (actual rows= loops=)

  • Filter: (((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (specification IS NULL) AND bank_approved AND (version = 0))
2.          

SubPlan (for Seq Scan)

3. 0.000 0.000 ↓ 0.0

Aggregate (cost=96,180.04..96,180.05 rows=1 width=8) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Hash Join (cost=117.52..96,176.10 rows=1,575 width=4) (actual rows= loops=)

  • Hash Cond: (p.contragents_registry_id = s.contragents_registry_id)
5. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..43,972.82 rows=3,786,910 width=8) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Seq Scan on bs_positions p (cost=0.00..19,357.91 rows=378,691 width=136) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Hash (cost=117.51..117.51 rows=1 width=4) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Subquery Scan on s (cost=117.47..117.51 rows=1 width=4) (actual rows= loops=)

  • Filter: (s.row_number = 1)
9. 0.000 0.000 ↓ 0.0

WindowAgg (cost=117.47..117.49 rows=1 width=52) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Sort (cost=117.47..117.47 rows=1 width=20) (actual rows= loops=)

  • Sort Key: s_1.specification, s_1.bank_date DESC
11. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.56..117.46 rows=1 width=20) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Index Scan using bs_requests_pkey on bs_requests r (cost=0.28..2.50 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = orig_r.id)
  • Filter: ((specification IS NULL) AND bank_approved AND (version = 0))
13. 0.000 0.000 ↓ 0.0

Index Scan using bs_requests_procedure_id_lot_id_idx on bs_requests s_1 (cost=0.28..114.95 rows=1 width=24) (actual rows= loops=)

  • Index Cond: ((lot_id = r.lot_id) AND (customer_id = r.customer_id))
  • Filter: (bank_approved AND (bank_date < '2020-01-01 00:00:00+03'::timestamp with time zone))
14. 0.000 0.000 ↓ 0.0

Aggregate (cost=96,180.04..96,180.05 rows=1 width=8) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash Join (cost=117.52..96,176.10 rows=1,575 width=4) (actual rows= loops=)

  • Hash Cond: (p_1.contragents_registry_id = s_2.contragents_registry_id)
16. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..43,972.82 rows=3,786,910 width=8) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Seq Scan on bs_positions p_1 (cost=0.00..19,357.91 rows=378,691 width=136) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Hash (cost=117.51..117.51 rows=1 width=4) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Subquery Scan on s_2 (cost=117.47..117.51 rows=1 width=4) (actual rows= loops=)

  • Filter: (s_2.row_number = 1)
20. 0.000 0.000 ↓ 0.0

WindowAgg (cost=117.47..117.49 rows=1 width=52) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Sort (cost=117.47..117.47 rows=1 width=20) (actual rows= loops=)

  • Sort Key: s_3.specification, s_3.bank_date DESC
22. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.56..117.46 rows=1 width=20) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Index Scan using bs_requests_pkey on bs_requests r_1 (cost=0.28..2.50 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = orig_r.id)
  • Filter: ((specification IS NULL) AND bank_approved AND (version = 0))
24. 0.000 0.000 ↓ 0.0

Index Scan using bs_requests_procedure_id_lot_id_idx on bs_requests s_3 (cost=0.28..114.95 rows=1 width=24) (actual rows= loops=)

  • Index Cond: ((lot_id = r_1.lot_id) AND (customer_id = r_1.customer_id))
  • Filter: (bank_approved AND (bank_date < '2020-03-23 00:00:00+03'::timestamp with time zone))
25. 0.000 0.000 ↓ 0.0

Aggregate (cost=96,180.04..96,180.05 rows=1 width=8) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Hash Join (cost=117.52..96,176.10 rows=1,575 width=4) (actual rows= loops=)

  • Hash Cond: (p_2.contragents_registry_id = s_4.contragents_registry_id)
27. 0.000 0.000 ↓ 0.0

ProjectSet (cost=0.00..43,972.82 rows=3,786,910 width=8) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Seq Scan on bs_positions p_2 (cost=0.00..19,357.91 rows=378,691 width=136) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Hash (cost=117.51..117.51 rows=1 width=4) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Subquery Scan on s_4 (cost=117.47..117.51 rows=1 width=4) (actual rows= loops=)

  • Filter: (s_4.row_number = 1)
31. 0.000 0.000 ↓ 0.0

WindowAgg (cost=117.47..117.49 rows=1 width=52) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Sort (cost=117.47..117.47 rows=1 width=20) (actual rows= loops=)

  • Sort Key: s_5.specification, s_5.bank_date DESC
33. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.56..117.46 rows=1 width=20) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Index Scan using bs_requests_pkey on bs_requests r_2 (cost=0.28..2.50 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = orig_r.id)
  • Filter: ((specification IS NULL) AND bank_approved AND (version = 0))
35. 0.000 0.000 ↓ 0.0

Index Scan using bs_requests_procedure_id_lot_id_idx on bs_requests s_5 (cost=0.28..114.95 rows=1 width=24) (actual rows= loops=)

  • Index Cond: ((lot_id = r_2.lot_id) AND (customer_id = r_2.customer_id))" Filter: (bank_approved AND (bank_date < '2020-05-18 00:00:00+03'::timestamp with time zone))