explain.depesz.com

PostgreSQL's explain analyze made readable

Result: mDKN

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

WindowAgg (cost=1.27..9,669,233,140.33 rows=3,706 width=233) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.27..22,790.41 rows=3,706 width=138) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..15,350.67 rows=3,706 width=105) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..7,910.93 rows=3,706 width=72) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Seq Scan on bs_requests rr (cost=0.00..471.19 rows=3,706 width=39) (actual rows= loops=)

  • Filter: ((specification IS NULL) AND bank_approved AND ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (version = 0))
6. 0.000 0.000 ↓ 0.0

Index Scan using contragents_pkey on contragents customer (cost=0.42..2.01 rows=1 width=41) (actual rows= loops=)

  • Index Cond: (id = rr.customer_id)
7. 0.000 0.000 ↓ 0.0

Index Scan using contragents_pkey on contragents organizer (cost=0.42..2.01 rows=1 width=41) (actual rows= loops=)

  • Index Cond: (id = rr.curator_id)
8. 0.000 0.000 ↓ 0.0

Index Scan using contragents_pkey on contragents winner (cost=0.42..2.01 rows=1 width=41) (actual rows= loops=)

  • Index Cond: (id = rr.winner_id)
9.          

SubPlan (for WindowAgg)

10. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,118.27..869,689.72 rows=1 width=36) (actual rows= loops=)

  • Group Key: s.original_request_id
11. 0.000 0.000 ↓ 0.0

Merge Join (cost=1,118.27..869,689.65 rows=12 width=12) (actual rows= loops=)

  • Merge Cond: (s.contragents_registry_id = p.contragents_registry_id)
12. 0.000 0.000 ↓ 0.0

Sort (cost=117.52..117.52 rows=1 width=8) (actual rows= loops=)

  • Sort Key: s.contragents_registry_id
13. 0.000 0.000 ↓ 0.0

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

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

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

15. 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
16. 0.000 0.000 ↓ 0.0

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

17. 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 = rr.id)
  • Filter: ((specification IS NULL) AND bank_approved AND ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (version = 0))
18. 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 ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (bank_date < '2020-01-01 00:00:00+03'::timestamp with time zone))
19. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,000.76..869,541.94 rows=2,405 width=12) (actual rows= loops=)

  • Group Key: p.contragents_registry_id
20. 0.000 0.000 ↓ 0.0

Gather Merge (cost=1,000.76..850,641.59 rows=3,775,260 width=8) (actual rows= loops=)

  • Workers Planned: 3
21. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.72..406,048.50 rows=1,217,826 width=8) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Parallel Index Scan using bs_positions_contragents_registry_id_has_bs_idx on bs_positions p (cost=0.42..21,160.20 rows=121,800 width=136) (actual rows= loops=)

  • Filter: (removed_date IS NULL)
23. 0.000 0.000 ↓ 0.0

Index Only Scan using bs_positions_contragents_pkey on bs_positions_contragents pc (cost=0.29..3.06 rows=10 width=4) (actual rows= loops=)

  • Index Cond: (id = ANY ((((p.deliverymans || p.providers) || p.dealers) || p.manufacturers)))
24. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,118.27..869,689.72 rows=1 width=36) (actual rows= loops=)

  • Group Key: s_2.original_request_id
25. 0.000 0.000 ↓ 0.0

Merge Join (cost=1,118.27..869,689.65 rows=12 width=12) (actual rows= loops=)

  • Merge Cond: (s_2.contragents_registry_id = p_1.contragents_registry_id)
26. 0.000 0.000 ↓ 0.0

Sort (cost=117.52..117.52 rows=1 width=8) (actual rows= loops=)

  • Sort Key: s_2.contragents_registry_id
27. 0.000 0.000 ↓ 0.0

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

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

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

29. 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
30. 0.000 0.000 ↓ 0.0

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

31. 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 = rr.id)
  • Filter: ((specification IS NULL) AND bank_approved AND ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (version = 0))
32. 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 ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (bank_date < '2020-03-23 00:00:00+03'::timestamp with time zone))
33. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,000.76..869,541.94 rows=2,405 width=12) (actual rows= loops=)

  • Group Key: p_1.contragents_registry_id
34. 0.000 0.000 ↓ 0.0

Gather Merge (cost=1,000.76..850,641.59 rows=3,775,260 width=8) (actual rows= loops=)

  • Workers Planned: 3
35. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.72..406,048.50 rows=1,217,826 width=8) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Parallel Index Scan using bs_positions_contragents_registry_id_has_bs_idx on bs_positions p_1 (cost=0.42..21,160.20 rows=121,800 width=136) (actual rows= loops=)

  • Filter: (removed_date IS NULL)
37. 0.000 0.000 ↓ 0.0

Index Only Scan using bs_positions_contragents_pkey on bs_positions_contragents pc_1 (cost=0.29..3.06 rows=10 width=4) (actual rows= loops=)

  • Index Cond: (id = ANY ((((p_1.deliverymans || p_1.providers) || p_1.dealers) || p_1.manufacturers)))
38. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,118.27..869,689.72 rows=1 width=36) (actual rows= loops=)

  • Group Key: s_4.original_request_id
39. 0.000 0.000 ↓ 0.0

Merge Join (cost=1,118.27..869,689.65 rows=12 width=12) (actual rows= loops=)

  • Merge Cond: (s_4.contragents_registry_id = p_2.contragents_registry_id)
40. 0.000 0.000 ↓ 0.0

Sort (cost=117.52..117.52 rows=1 width=8) (actual rows= loops=)

  • Sort Key: s_4.contragents_registry_id
41. 0.000 0.000 ↓ 0.0

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

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

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

43. 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
44. 0.000 0.000 ↓ 0.0

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

45. 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 = rr.id)
  • Filter: ((specification IS NULL) AND bank_approved AND ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (version = 0))
46. 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 ((NOT is_bs_works) OR (is_bs_works IS NULL)) AND (bank_date < '2020-05-18 00:00:00+03'::timestamp with time zone))
47. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=1,000.76..869,541.94 rows=2,405 width=12) (actual rows= loops=)

  • Group Key: p_2.contragents_registry_id
48. 0.000 0.000 ↓ 0.0

Gather Merge (cost=1,000.76..850,641.59 rows=3,775,260 width=8) (actual rows= loops=)

  • Workers Planned: 3
49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.72..406,048.50 rows=1,217,826 width=8) (actual rows= loops=)

  • -> Index Only Scan using bs_positions_contragents_pkey on bs_positions_contragents pc_2 (cost=0.29..3.06 rows=10 width=4)" Index Cond: (id = ANY ((((p_2.deliverymans || p_2.providers) || p_2.dealers) || p_2.manufacturers)))
50. 0.000 0.000 ↓ 0.0

Parallel Index Scan using bs_positions_contragents_registry_id_has_bs_idx on bs_positions p_2 (cost=0.42..21,160.20 rows=121,800 width=136) (actual rows= loops=)

  • Filter: (removed_date IS NULL)