explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 66VF

Settings
# exclusive inclusive rows x rows loops node
1. 0.021 12,038.434 ↓ 2.0 2 1

Nested Loop (cost=412,604.56..452,309.46 rows=1 width=920) (actual time=10,130.185..12,038.434 rows=2 loops=1)

2. 100.220 12,038.391 ↓ 2.0 2 1

Hash Right Join (cost=412,604.43..452,309.29 rows=1 width=2,037) (actual time=10,130.159..12,038.391 rows=2 loops=1)

  • Hash Cond: ((deal.deal_pair_fkey)::text = (deal_1.parent_fkey)::text)
  • Join Filter: (COALESCE(deal_1.is_buyer, deal_details_1.is_buyer) AND ((deal_details_wood_class.id = deal_details_wood_class_1.id) OR (deal_details_tnved_class.id = deal_details_tnved_class_1.id)))
  • Rows Removed by Join Filter: 2
3. 308.348 11,937.846 ↓ 1.4 711,958 1

Hash Join (cost=412,549.25..450,365.85 rows=503,531 width=949) (actual time=9,293.189..11,937.846 rows=711,958 loops=1)

  • Hash Cond: (party_buyer.party_type_fkey = party_buyer_type.id)
4. 373.911 11,629.492 ↓ 1.4 711,958 1

Hash Left Join (cost=412,548.16..447,642.54 rows=503,531 width=909) (actual time=9,293.177..11,629.492 rows=711,958 loops=1)

  • Hash Cond: (deal_details_wood_class.lu_timber_fkey = deal_details_timber_okpd.id)
5. 381.905 11,255.572 ↓ 1.4 711,958 1

Hash Left Join (cost=412,529.38..446,293.06 rows=503,531 width=911) (actual time=9,293.157..11,255.572 rows=711,958 loops=1)

  • Hash Cond: (deal_details.wood_class_fkey = deal_details_wood_class.id)
6. 236.990 10,873.454 ↓ 1.4 711,958 1

Hash Left Join (cost=412,515.43..444,933.33 rows=503,531 width=837) (actual time=9,292.935..10,873.454 rows=711,958 loops=1)

  • Hash Cond: (deal_details_tnved_class.lu_timber_fkey = deal_details_timber_tnved.id)
7. 225.173 10,636.450 ↓ 1.4 711,958 1

Hash Left Join (cost=412,496.66..443,582.53 rows=503,531 width=805) (actual time=9,292.908..10,636.450 rows=711,958 loops=1)

  • Hash Cond: (deal_details.lu_tnved_class_fkey = deal_details_tnved_class.id)
8. 1,008.338 10,411.051 ↓ 1.4 711,958 1

Hash Join (cost=412,475.04..442,238.54 rows=503,531 width=673) (actual time=9,292.658..10,411.051 rows=711,958 loops=1)

  • Hash Cond: ((deal_details.bo_contract_hardwood_fkey)::text = (deal.id)::text)
9. 110.192 110.192 ↓ 1.0 822,146 1

Seq Scan on bo_hardwood_deal_details deal_details (cost=0.00..21,645.23 rows=822,123 width=29) (actual time=0.005..110.192 rows=822,146 loops=1)

10. 386.986 9,292.521 ↓ 1.4 372,854 1

Hash (cost=409,213.83..409,213.83 rows=260,897 width=653) (actual time=9,292.521..9,292.521 rows=372,854 loops=1)

  • Buckets: 524288 (originally 262144) Batches: 1 (originally 1) Memory Usage: 282381kB
11. 13.186 8,905.535 ↓ 1.4 372,854 1

Gather (cost=246,146.56..409,213.83 rows=260,897 width=653) (actual time=6,754.440..8,905.535 rows=372,854 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
12. 60.730 8,892.349 ↓ 1.1 124,285 3

Hash Join (cost=245,146.56..382,124.13 rows=108,707 width=653) (actual time=7,059.741..8,892.349 rows=124,285 loops=3)

  • Hash Cond: (party_seller.party_type_fkey = party_seller_type.id)
13. 59.477 8,831.592 ↓ 1.1 124,285 3

Hash Left Join (cost=245,145.47..381,535.34 rows=108,707 width=613) (actual time=7,059.630..8,831.592 rows=124,285 loops=3)

  • Hash Cond: (buyer_subject.bo_federal_district_fkey = buyer_federal_district.id)
14. 154.918 8,772.108 ↓ 1.1 124,285 3

Hash Left Join (cost=245,144.26..381,114.40 rows=108,707 width=556) (actual time=7,059.618..8,772.108 rows=124,285 loops=3)

  • Hash Cond: ("substring"(party_buyer.inn, 1, 2) = regexp_replace((buyer_subject.id)::text, '^(\d)$'::text, '0\1'::text))
15. 166.570 8,617.067 ↓ 1.1 124,285 3

Hash Join (cost=245,141.35..379,698.30 rows=108,707 width=515) (actual time=7,059.476..8,617.067 rows=124,285 loops=3)

  • Hash Cond: ((deal.bo_party_buyer_fkey)::text = (party_buyer.id)::text)
16. 57.457 5,122.606 ↓ 1.1 124,285 3

Hash Left Join (cost=134,817.33..269,088.92 rows=108,707 width=374) (actual time=3,724.455..5,122.606 rows=124,285 loops=3)

  • Hash Cond: (seller_subject.bo_federal_district_fkey = seller_federal_district.id)
17. 193.305 5,065.124 ↓ 1.1 124,285 3

Hash Left Join (cost=134,816.12..268,667.99 rows=108,707 width=317) (actual time=3,724.404..5,065.124 rows=124,285 loops=3)

  • Hash Cond: ("substring"(party_seller.inn, 1, 2) = regexp_replace((seller_subject.id)::text, '^(\d)$'::text, '0\1'::text))
18. 129.898 4,871.561 ↓ 1.1 124,285 3

Hash Join (cost=134,813.21..267,251.89 rows=108,707 width=276) (actual time=3,724.124..4,871.561 rows=124,285 loops=3)

  • Hash Cond: ((deal.bo_party_seller_fkey)::text = (party_seller.id)::text)
19. 443.187 1,411.251 ↓ 1.1 124,285 3

Hash Join (cost=24,489.18..156,642.51 rows=108,707 width=134) (actual time=388.383..1,411.251 rows=124,285 loops=3)

  • Hash Cond: ((base.id)::text = (deal.bo_document_fkey)::text)
20. 581.077 581.077 ↑ 1.2 866,990 3

Parallel Seq Scan on bo_document_base base (cost=0.00..127,002.27 rows=1,083,727 width=45) (actual time=0.070..581.077 rows=866,990 loops=3)

  • Filter: ((contract_num <> 'HLSF-1949'::text) AND (status = 2) AND ((id)::text <> ALL ('{G_45791622,G_168914525,G_254018099,P_2655484}'::text[])))
  • Rows Removed by Filter: 548477
21. 194.768 386.987 ↑ 1.0 425,956 3

Hash (cost=19,164.71..19,164.71 rows=425,958 width=98) (actual time=386.987..386.987 rows=425,956 loops=3)

  • Buckets: 524288 Batches: 1 Memory Usage: 60584kB
22. 192.219 192.219 ↑ 1.0 425,956 3

Seq Scan on bo_contract_hardwood_deal deal (cost=0.00..19,164.71 rows=425,958 width=98) (actual time=0.037..192.219 rows=425,956 loops=3)

  • Filter: actual
  • Rows Removed by Filter: 13
23. 986.958 3,330.412 ↑ 1.0 1,951,201 3

Hash (cost=85,934.01..85,934.01 rows=1,951,201 width=160) (actual time=3,330.412..3,330.412 rows=1,951,201 loops=3)

  • Buckets: 2097152 Batches: 1 Memory Usage: 403185kB
24. 2,343.454 2,343.454 ↑ 1.0 1,951,201 3

Seq Scan on bo_party party_seller (cost=0.00..85,934.01 rows=1,951,201 width=160) (actual time=0.024..2,343.454 rows=1,951,201 loops=3)

25. 0.200 0.258 ↑ 1.0 85 3

Hash (cost=1.85..1.85 rows=85 width=41) (actual time=0.258..0.258 rows=85 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
26. 0.058 0.058 ↑ 1.0 85 3

Seq Scan on bo_constituent_entity seller_subject (cost=0.00..1.85 rows=85 width=41) (actual time=0.043..0.058 rows=85 loops=3)

27. 0.003 0.025 ↑ 1.0 9 3

Hash (cost=1.09..1.09 rows=9 width=59) (actual time=0.025..0.025 rows=9 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
28. 0.022 0.022 ↑ 1.0 9 3

Seq Scan on bo_federal_district seller_federal_district (cost=0.00..1.09 rows=9 width=59) (actual time=0.021..0.022 rows=9 loops=3)

29. 1,020.403 3,327.891 ↑ 1.0 1,951,201 3

Hash (cost=85,934.01..85,934.01 rows=1,951,201 width=160) (actual time=3,327.891..3,327.891 rows=1,951,201 loops=3)

  • Buckets: 2097152 Batches: 1 Memory Usage: 403185kB
30. 2,307.488 2,307.488 ↑ 1.0 1,951,201 3

Seq Scan on bo_party party_buyer (cost=0.00..85,934.01 rows=1,951,201 width=160) (actual time=0.032..2,307.488 rows=1,951,201 loops=3)

31. 0.105 0.123 ↑ 1.0 85 3

Hash (cost=1.85..1.85 rows=85 width=41) (actual time=0.123..0.123 rows=85 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
32. 0.018 0.018 ↑ 1.0 85 3

Seq Scan on bo_constituent_entity buyer_subject (cost=0.00..1.85 rows=85 width=41) (actual time=0.004..0.018 rows=85 loops=3)

33. 0.002 0.007 ↑ 1.0 9 3

Hash (cost=1.09..1.09 rows=9 width=59) (actual time=0.007..0.007 rows=9 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
34. 0.005 0.005 ↑ 1.0 9 3

Seq Scan on bo_federal_district buyer_federal_district (cost=0.00..1.09 rows=9 width=59) (actual time=0.003..0.005 rows=9 loops=3)

35. 0.005 0.027 ↑ 1.0 4 3

Hash (cost=1.04..1.04 rows=4 width=42) (actual time=0.027..0.027 rows=4 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
36. 0.022 0.022 ↑ 1.0 4 3

Seq Scan on lu_party_type party_seller_type (cost=0.00..1.04 rows=4 width=42) (actual time=0.021..0.022 rows=4 loops=3)

37. 0.086 0.226 ↑ 1.0 294 1

Hash (cost=17.94..17.94 rows=294 width=134) (actual time=0.226..0.226 rows=294 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 55kB
38. 0.140 0.140 ↑ 1.0 294 1

Seq Scan on lu_tnved_class deal_details_tnved_class (cost=0.00..17.94 rows=294 width=134) (actual time=0.020..0.140 rows=294 loops=1)

39. 0.002 0.014 ↑ 195.0 2 1

Hash (cost=13.90..13.90 rows=390 width=34) (actual time=0.014..0.014 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
40. 0.012 0.012 ↑ 195.0 2 1

Seq Scan on lu_timber deal_details_timber_tnved (cost=0.00..13.90 rows=390 width=34) (actual time=0.011..0.012 rows=2 loops=1)

41. 0.077 0.213 ↑ 1.0 220 1

Hash (cost=11.20..11.20 rows=220 width=76) (actual time=0.213..0.213 rows=220 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 31kB
42. 0.136 0.136 ↑ 1.0 220 1

Seq Scan on lu_wood_class deal_details_wood_class (cost=0.00..11.20 rows=220 width=76) (actual time=0.010..0.136 rows=220 loops=1)

43. 0.002 0.009 ↑ 195.0 2 1

Hash (cost=13.90..13.90 rows=390 width=34) (actual time=0.009..0.009 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
44. 0.007 0.007 ↑ 195.0 2 1

Seq Scan on lu_timber deal_details_timber_okpd (cost=0.00..13.90 rows=390 width=34) (actual time=0.007..0.007 rows=2 loops=1)

45. 0.001 0.006 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=42) (actual time=0.006..0.006 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
46. 0.005 0.005 ↑ 1.0 4 1

Seq Scan on lu_party_type party_buyer_type (cost=0.00..1.04 rows=4 width=42) (actual time=0.004..0.005 rows=4 loops=1)

47. 0.004 0.325 ↓ 2.0 2 1

Hash (cost=55.17..55.17 rows=1 width=1,088) (actual time=0.325..0.325 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
48. 0.004 0.321 ↓ 2.0 2 1

Nested Loop (cost=30.12..55.17 rows=1 width=1,088) (actual time=0.259..0.321 rows=2 loops=1)

49. 0.003 0.313 ↓ 2.0 2 1

Nested Loop Left Join (cost=29.99..55.02 rows=1 width=1,048) (actual time=0.254..0.313 rows=2 loops=1)

50. 0.001 0.310 ↓ 2.0 2 1

Nested Loop Left Join (cost=29.84..54.32 rows=1 width=1,016) (actual time=0.252..0.310 rows=2 loops=1)

51. 0.002 0.307 ↓ 2.0 2 1

Nested Loop (cost=29.57..53.49 rows=1 width=884) (actual time=0.250..0.307 rows=2 loops=1)

52. 0.003 0.281 ↓ 2.0 2 1

Nested Loop Left Join (cost=29.14..45.02 rows=1 width=848) (actual time=0.234..0.281 rows=2 loops=1)

53. 0.003 0.272 ↓ 2.0 2 1

Nested Loop Left Join (cost=28.99..44.27 rows=1 width=816) (actual time=0.228..0.272 rows=2 loops=1)

54. 0.002 0.261 ↓ 2.0 2 1

Nested Loop (cost=28.84..43.66 rows=1 width=742) (actual time=0.221..0.261 rows=2 loops=1)

55. 0.001 0.244 ↑ 1.0 1 1

Nested Loop Left Join (cost=28.42..31.21 rows=1 width=721) (actual time=0.207..0.244 rows=1 loops=1)

56. 0.070 0.241 ↑ 1.0 1 1

Hash Right Join (cost=28.28..30.89 rows=1 width=664) (actual time=0.204..0.241 rows=1 loops=1)

  • Hash Cond: (regexp_replace((seller_subject_1.id)::text, '^(\d)$'::text, '0\1'::text) = "substring"(party_seller_1.inn, 1, 2))
57. 0.008 0.008 ↑ 1.0 85 1

Seq Scan on bo_constituent_entity seller_subject_1 (cost=0.00..1.85 rows=85 width=41) (actual time=0.003..0.008 rows=85 loops=1)

58. 0.003 0.163 ↑ 1.0 1 1

Hash (cost=28.27..28.27 rows=1 width=623) (actual time=0.162..0.163 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
59. 0.002 0.160 ↑ 1.0 1 1

Nested Loop (cost=17.46..28.27 rows=1 width=623) (actual time=0.123..0.160 rows=1 loops=1)

60. 0.002 0.146 ↑ 1.0 1 1

Nested Loop Left Join (cost=17.03..19.83 rows=1 width=409) (actual time=0.108..0.146 rows=1 loops=1)

61. 0.079 0.140 ↑ 1.0 1 1

Hash Right Join (cost=16.90..19.50 rows=1 width=352) (actual time=0.103..0.140 rows=1 loops=1)

  • Hash Cond: (regexp_replace((buyer_subject_1.id)::text, '^(\d)$'::text, '0\1'::text) = "substring"(party_buyer_1.inn, 1, 2))
62. 0.019 0.019 ↑ 1.0 85 1

Seq Scan on bo_constituent_entity buyer_subject_1 (cost=0.00..1.85 rows=85 width=41) (actual time=0.013..0.019 rows=85 loops=1)

63. 0.004 0.042 ↑ 1.0 1 1

Hash (cost=16.89..16.89 rows=1 width=311) (actual time=0.042..0.042 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
64. 0.003 0.038 ↑ 1.0 1 1

Nested Loop (cost=0.85..16.89 rows=1 width=311) (actual time=0.037..0.038 rows=1 loops=1)

65. 0.021 0.021 ↑ 1.0 1 1

Index Scan using bo_contract_hardwood_deal__bo_document_fkey on bo_contract_hardwood_deal deal_1 (cost=0.42..8.44 rows=1 width=98) (actual time=0.020..0.021 rows=1 loops=1)

  • Index Cond: ((bo_document_fkey)::text = 'P_1833869'::text)
  • Filter: actual
66. 0.014 0.014 ↑ 1.0 1 1

Index Scan using bo_party_pkey on bo_party party_buyer_1 (cost=0.43..8.45 rows=1 width=232) (actual time=0.014..0.014 rows=1 loops=1)

  • Index Cond: ((id)::text = (deal_1.bo_party_buyer_fkey)::text)
67. 0.004 0.004 ↑ 1.0 1 1

Index Scan using bo_fed_district_pkey on bo_federal_district buyer_federal_district_1 (cost=0.14..0.29 rows=1 width=59) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (id = buyer_subject_1.bo_federal_district_fkey)
68. 0.012 0.012 ↑ 1.0 1 1

Index Scan using bo_party_pkey on bo_party party_seller_1 (cost=0.43..8.45 rows=1 width=232) (actual time=0.012..0.012 rows=1 loops=1)

  • Index Cond: ((id)::text = (deal_1.bo_party_seller_fkey)::text)
69. 0.002 0.002 ↑ 1.0 1 1

Index Scan using bo_fed_district_pkey on bo_federal_district seller_federal_district_1 (cost=0.14..0.29 rows=1 width=59) (actual time=0.002..0.002 rows=1 loops=1)

  • Index Cond: (id = seller_subject_1.bo_federal_district_fkey)
70. 0.015 0.015 ↓ 2.0 2 1

Index Scan using bo_contract_hardwood_deal__bo_contract_hardwood_fkey on bo_hardwood_deal_details deal_details_1 (cost=0.42..12.44 rows=1 width=29) (actual time=0.012..0.015 rows=2 loops=1)

  • Index Cond: ((bo_contract_hardwood_fkey)::text = (deal_1.id)::text)
  • Filter: COALESCE(deal_1.is_buyer, is_buyer)
71. 0.008 0.008 ↑ 1.0 1 2

Index Scan using lu_wood_class_pkey on lu_wood_class deal_details_wood_class_1 (cost=0.14..0.61 rows=1 width=76) (actual time=0.004..0.004 rows=1 loops=2)

  • Index Cond: (id = deal_details_1.wood_class_fkey)
72. 0.006 0.006 ↑ 1.0 1 2

Index Scan using lu_timber_pkey on lu_timber deal_details_timber_okpd_1 (cost=0.15..0.75 rows=1 width=34) (actual time=0.003..0.003 rows=1 loops=2)

  • Index Cond: (id = deal_details_wood_class_1.lu_timber_fkey)
73. 0.024 0.024 ↑ 1.0 1 2

Index Scan using bo_document_base_id_status_idx on bo_document_base base_1 (cost=0.43..8.46 rows=1 width=45) (actual time=0.011..0.012 rows=1 loops=2)

  • Index Cond: (((id)::text = 'P_1833869'::text) AND (status = 2))
  • Filter: (contract_num <> 'HLSF-1949'::text)
74. 0.002 0.002 ↓ 0.0 0 2

Index Scan using lu_tnved_class_pkey on lu_tnved_class deal_details_tnved_class_1 (cost=0.27..0.82 rows=1 width=134) (actual time=0.001..0.001 rows=0 loops=2)

  • Index Cond: (id = deal_details_1.lu_tnved_class_fkey)
75. 0.000 0.000 ↓ 0.0 0 2

Index Scan using lu_timber_pkey on lu_timber deal_details_timber_tnved_1 (cost=0.15..0.70 rows=1 width=34) (actual time=0.000..0.000 rows=0 loops=2)

  • Index Cond: (id = deal_details_tnved_class_1.lu_timber_fkey)
76. 0.004 0.004 ↑ 1.0 1 2

Index Scan using lu_party_type_pkey on lu_party_type party_seller_type_1 (cost=0.13..0.15 rows=1 width=42) (actual time=0.002..0.002 rows=1 loops=2)

  • Index Cond: (id = party_seller_1.party_type_fkey)
77. 0.022 0.022 ↑ 1.0 1 2

Index Scan using lu_party_type_pkey on lu_party_type party_buyer_type_1 (cost=0.13..0.15 rows=1 width=42) (actual time=0.011..0.011 rows=1 loops=2)

  • Index Cond: (id = party_buyer_1.party_type_fkey)
Planning time : 318.080 ms
Execution time : 12,047.814 ms