explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hg8m

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

Limit (cost=6,583,731.74..6,583,733.37 rows=50 width=649) (actual rows= loops=)

2.          

CTE s

3. 0.000 0.000 ↓ 0.0

Subquery Scan on t (cost=6,410,632.44..6,463,730.37 rows=4,247,834 width=576) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=6,410,632.44..6,421,252.03 rows=4,247,834 width=537) (actual rows= loops=)

  • Sort Key: _foo.cession_id, cs.cession_loan_id
5.          

CTE t_clcc

6. 0.000 0.000 ↓ 0.0

Merge Right Join (cost=1,520.62..6,316.10 rows=292,421 width=197) (actual rows= loops=)

  • Merge Cond: (with_without_move_1.cession_loan_client_id = t1.cession_loan_client_id)
7.          

CTE without_without_move

8. 0.000 0.000 ↓ 0.0

HashAggregate (cost=123.39..146.09 rows=2,270 width=13) (actual rows= loops=)

  • Group Key: cession_loan_client_court.cession_loan_client_id
9. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_client_court (cost=0.00..111.28 rows=2,422 width=13) (actual rows= loops=)

  • Filter: ((court_decision)::text <> 'without_move'::text)
10.          

CTE with_without_move

11. 0.000 0.000 ↓ 0.0

HashAggregate (cost=117.33..140.03 rows=2,270 width=13) (actual rows= loops=)

  • Group Key: cession_loan_client_court_1.cession_loan_client_id
12. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_client_court cession_loan_client_court_1 (cost=0.00..105.22 rows=2,422 width=13) (actual rows= loops=)

13.          

CTE t1

14. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=630.92..718.70 rows=2,270 width=128) (actual rows= loops=)

  • Group Key: cession_loan_client_court_2.cession_loan_client_id
15. 0.000 0.000 ↓ 0.0

Sort (cost=630.92..636.97 rows=2,422 width=128) (actual rows= loops=)

  • Sort Key: cession_loan_client_court_2.cession_loan_client_id
16. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=341.49..494.78 rows=2,422 width=128) (actual rows= loops=)

  • Hash Cond: (cession_loan_client_court_2.fssp_id = fssp.fssp_id)
17. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=291.32..416.87 rows=2,422 width=77) (actual rows= loops=)

  • Hash Cond: (with_without_move.cession_loan_client_id = cession_loan_client_court_2.cession_loan_client_id)
18. 0.000 0.000 ↓ 0.0

CTE Scan on with_without_move (cost=0.00..45.40 rows=2,270 width=4) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Hash (cost=261.05..261.05 rows=2,422 width=77) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=135.50..261.05 rows=2,422 width=77) (actual rows= loops=)

  • Hash Cond: (without_without_move.cession_loan_client_id = cession_loan_client_court_2.cession_loan_client_id)
21. 0.000 0.000 ↓ 0.0

CTE Scan on without_without_move (cost=0.00..45.40 rows=2,270 width=4) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Hash (cost=105.22..105.22 rows=2,422 width=77) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_client_court cession_loan_client_court_2 (cost=0.00..105.22 rows=2,422 width=77) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Hash (cost=36.74..36.74 rows=1,074 width=59) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Seq Scan on fssp (cost=0.00..36.74 rows=1,074 width=59) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Sort (cost=171.94..177.61 rows=2,270 width=36) (actual rows= loops=)

  • Sort Key: with_without_move_1.cession_loan_client_id
27. 0.000 0.000 ↓ 0.0

CTE Scan on with_without_move with_without_move_1 (cost=0.00..45.40 rows=2,270 width=36) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Materialize (cost=343.87..806.09 rows=25,764 width=165) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=343.87..741.68 rows=25,764 width=165) (actual rows= loops=)

  • Merge Cond: (t1.cession_loan_client_id = without_without_move_1.cession_loan_client_id)
30. 0.000 0.000 ↓ 0.0

Sort (cost=171.94..177.61 rows=2,270 width=133) (actual rows= loops=)

  • Sort Key: t1.cession_loan_client_id
31. 0.000 0.000 ↓ 0.0

CTE Scan on t1 (cost=0.00..45.40 rows=2,270 width=133) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Sort (cost=171.94..177.61 rows=2,270 width=36) (actual rows= loops=)

  • Sort Key: without_without_move_1.cession_loan_client_id
33. 0.000 0.000 ↓ 0.0

CTE Scan on without_without_move without_without_move_1 (cost=0.00..45.40 rows=2,270 width=36) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,113,887.63..2,844,122.01 rows=4,247,834 width=537) (actual rows= loops=)

  • Hash Cond: (clc.installment_plan_id = ip.installment_plan_id)
35. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=1,113,882.23..1,435,538.51 rows=4,247,834 width=532) (actual rows= loops=)

  • Hash Cond: (ccl.cession_loan_id = cs.cession_loan_id)
36. 0.000 0.000 ↓ 0.0

Subquery Scan on ccl (cost=344.93..410.10 rows=3,724 width=40) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Unique (cost=344.93..372.86 rows=3,724 width=48) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Sort (cost=344.93..354.24 rows=3,724 width=48) (actual rows= loops=)

  • Sort Key: cession.cession_date, cession_cession_loan.cession_loan_id
39. 0.000 0.000 ↓ 0.0

Hash Join (cost=6.89..124.05 rows=3,724 width=48) (actual rows= loops=)

  • Hash Cond: (cession_cession_loan.cession_id = cession.cession_id)
40. 0.000 0.000 ↓ 0.0

Seq Scan on cession_cession_loan (cost=0.00..65.95 rows=3,724 width=16) (actual rows= loops=)

  • Filter: first_cession
41. 0.000 0.000 ↓ 0.0

Hash (cost=5.26..5.26 rows=131 width=48) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1.77..5.26 rows=131 width=48) (actual rows= loops=)

  • Hash Cond: (cession.claimant_id = claimant.claimant_id)
43. 0.000 0.000 ↓ 0.0

Seq Scan on cession (cost=0.00..2.31 rows=131 width=24) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Hash (cost=1.34..1.34 rows=34 width=36) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Seq Scan on claimant (cost=0.00..1.34 rows=34 width=36) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Hash (cost=786,652.37..786,652.37 rows=4,247,834 width=500) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=469,801.81..786,652.37 rows=4,247,834 width=500) (actual rows= loops=)

  • Hash Cond: (_last_comment.cession_loan_id = cs.cession_loan_id)
48. 0.000 0.000 ↓ 0.0

Subquery Scan on _last_comment (cost=3,250.96..3,324.44 rows=3,674 width=16) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

HashAggregate (cost=3,250.96..3,287.70 rows=3,674 width=16) (actual rows= loops=)

  • Group Key: cession_comment.cession_loan_id
50. 0.000 0.000 ↓ 0.0

Seq Scan on cession_comment (cost=0.00..3,047.64 rows=40,664 width=16) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Hash (cost=143,814.92..143,814.92 rows=4,247,834 width=492) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=58,468.03..143,814.92 rows=4,247,834 width=492) (actual rows= loops=)

  • Merge Cond: (clc.cession_loan_client_id = tnec.cession_loan_client_id)
53. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=58,385.47..123,132.19 rows=4,247,834 width=484) (actual rows= loops=)

  • Merge Cond: (clc.cession_loan_client_id = t_clcc.cession_loan_client_id)
54. 0.000 0.000 ↓ 0.0

Sort (cost=21,988.11..22,137.19 rows=59,631 width=484) (actual rows= loops=)

  • Sort Key: clc.cession_loan_client_id
55. 0.000 0.000 ↓ 0.0

Merge Right Join (cost=2,705.49..4,213.74 rows=59,631 width=484) (actual rows= loops=)

  • Merge Cond: (phone.client_id = ((clc.client_id)::bigint))
56. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=0.28..421.41 rows=2,906 width=17) (actual rows= loops=)

  • Group Key: phone.client_id
57. 0.000 0.000 ↓ 0.0

Index Scan using fki_client_id on phone (cost=0.28..317.43 rows=6,765 width=17) (actual rows= loops=)

  • Index Cond: (client_id IS NOT NULL)
  • Filter: ((nomer IS NOT NULL) AND ((nomer)::text !~~* ''::text))
58. 0.000 0.000 ↓ 0.0

Sort (cost=2,705.21..2,715.47 rows=4,104 width=452) (actual rows= loops=)

  • Sort Key: ((clc.client_id)::bigint)
59. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,972.39..2,458.91 rows=4,104 width=452) (actual rows= loops=)

  • Hash Cond: (cs.cession_loan_id = p_after_assigment.cession_loan_id)
60. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,198.52..1,669.54 rows=4,104 width=420) (actual rows= loops=)

  • Hash Cond: (clc.client_id = client.client_id)
61. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=710.54..1,114.88 rows=4,104 width=343) (actual rows= loops=)

  • Hash Cond: (clc.client_role_id = cr.client_role_id)
62. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=709.47..1,057.38 rows=4,104 width=311) (actual rows= loops=)

  • Hash Cond: (clc.cession_loan_status_id = css.cession_loan_status_id)
63. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=707.89..999.37 rows=4,104 width=247) (actual rows= loops=)

  • Hash Cond: (cs.region_id = r.region_id)
64. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=703.71..938.75 rows=4,104 width=226) (actual rows= loops=)

  • Hash Cond: (cs.cession_loan_status_type_id = clst.cession_loan_status_type_id)
65. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=702.64..883.25 rows=4,104 width=194) (actual rows= loops=)

  • Hash Cond: (cs.cession_loan_id = _foo.cession_loan_id)
66. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=225.23..385.11 rows=4,104 width=137) (actual rows= loops=)

  • Hash Cond: (clc.cession_loan_id = cs.cession_loan_id)
67. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_client clc (cost=0.00..88.05 rows=4,105 width=50) (actual rows= loops=)

68. 0.000 0.000 ↓ 0.0

Hash (cost=178.63..178.63 rows=3,728 width=91) (actual rows= loops=)

69. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=151.13..178.63 rows=3,728 width=91) (actual rows= loops=)

  • Hash Cond: (cession_loan_get_percent_sum_by_date.cession_loan_id = cs.cession_loan_id)
70. 0.000 0.000 ↓ 0.0

Function Scan on cession_loan_get_percent_sum_by_date (cost=0.25..10.25 rows=1,000 width=16) (actual rows= loops=)

71. 0.000 0.000 ↓ 0.0

Hash (cost=104.28..104.28 rows=3,728 width=83) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan cs (cost=0.00..104.28 rows=3,728 width=83) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Hash (cost=477.17..477.17 rows=19 width=65) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=353.40..477.17 rows=19 width=65) (actual rows= loops=)

  • Hash Cond: (csn.claimant_id = cl.claimant_id)
75. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=351.64..475.24 rows=19 width=33) (actual rows= loops=)

  • Hash Cond: (_foo.cession_id = csn.cession_id)
76. 0.000 0.000 ↓ 0.0

Subquery Scan on _foo (cost=347.69..471.03 rows=19 width=16) (actual rows= loops=)

  • Filter: (_foo.row_number = 1)
77. 0.000 0.000 ↓ 0.0

WindowAgg (cost=347.69..423.59 rows=3,795 width=28) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Sort (cost=347.69..357.18 rows=3,795 width=28) (actual rows= loops=)

  • Sort Key: cession_cession_loan_1.cession_loan_id, cession_1.cession_date
79. 0.000 0.000 ↓ 0.0

Hash Join (cost=3.95..122.08 rows=3,795 width=28) (actual rows= loops=)

  • Hash Cond: (cession_cession_loan_1.cession_id = cession_1.cession_id)
  • -> Seq Scan on cession_cession_loan cession_cession_loan_1 (cost=0.00..65.95 rows=3795 width=2 (...)
80. 0.000 0.000 ↓ 0.0

Hash (cost=2.31..2.31 rows=131 width=16) (actual rows= loops=)

81. 0.000 0.000 ↓ 0.0

Seq Scan on cession cession_1 (cost=0.00..2.31 rows=131 width=16) (actual rows= loops=)

82. 0.000 0.000 ↓ 0.0

Hash (cost=2.31..2.31 rows=131 width=25) (actual rows= loops=)

83. 0.000 0.000 ↓ 0.0

Seq Scan on cession csn (cost=0.00..2.31 rows=131 width=25) (actual rows= loops=)

84. 0.000 0.000 ↓ 0.0

Hash (cost=1.34..1.34 rows=34 width=40) (actual rows= loops=)

85. 0.000 0.000 ↓ 0.0

Seq Scan on claimant cl (cost=0.00..1.34 rows=34 width=40) (actual rows= loops=)

86. 0.000 0.000 ↓ 0.0

Hash (cost=1.03..1.03 rows=3 width=36) (actual rows= loops=)

87. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_status_type clst (cost=0.00..1.03 rows=3 width=36) (actual rows= loops=)

88. 0.000 0.000 ↓ 0.0

Hash (cost=2.97..2.97 rows=97 width=25) (actual rows= loops=)

89. 0.000 0.000 ↓ 0.0

Seq Scan on region r (cost=0.00..2.97 rows=97 width=25) (actual rows= loops=)

90. 0.000 0.000 ↓ 0.0

Hash (cost=1.26..1.26 rows=26 width=72) (actual rows= loops=)

91. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_status css (cost=0.00..1.26 rows=26 width=72) (actual rows= loops=)

92. 0.000 0.000 ↓ 0.0

Hash (cost=1.03..1.03 rows=3 width=36) (actual rows= loops=)

93. 0.000 0.000 ↓ 0.0

Seq Scan on client_role cr (cost=0.00..1.03 rows=3 width=36) (actual rows= loops=)

94. 0.000 0.000 ↓ 0.0

Hash (cost=444.10..444.10 rows=3,510 width=85) (actual rows= loops=)

95. 0.000 0.000 ↓ 0.0

Seq Scan on client (cost=0.00..444.10 rows=3,510 width=85) (actual rows= loops=)

96. 0.000 0.000 ↓ 0.0

Hash (cost=773.76..773.76 rows=9 width=40) (actual rows= loops=)

97. 0.000 0.000 ↓ 0.0

Subquery Scan on p_after_assigment (cost=773.56..773.76 rows=9 width=40) (actual rows= loops=)

98. 0.000 0.000 ↓ 0.0

HashAggregate (cost=773.56..773.67 rows=9 width=14) (actual rows= loops=)

  • Group Key: pay.cession_loan_id
99. 0.000 0.000 ↓ 0.0

Hash Join (cost=475.47..773.51 rows=9 width=14) (actual rows= loops=)

  • Hash Cond: (pay.cession_loan_id = _foo_1.cession_loan_id)
  • Join Filter: ((cession_2.cession_date)::date <= pay.pay_date)
100. 0.000 0.000 ↓ 0.0

Seq Scan on pay (cost=0.00..270.08 rows=5,508 width=18) (actual rows= loops=)

101. 0.000 0.000 ↓ 0.0

Hash (cost=475.24..475.24 rows=19 width=16) (actual rows= loops=)

102. 0.000 0.000 ↓ 0.0

Hash Join (cost=351.64..475.24 rows=19 width=16) (actual rows= loops=)

  • Hash Cond: (_foo_1.cession_id = cession_2.cession_id)
103. 0.000 0.000 ↓ 0.0

Subquery Scan on _foo_1 (cost=347.69..471.03 rows=19 width=16) (actual rows= loops=)

  • Filter: (_foo_1.row_number = 1)
104. 0.000 0.000 ↓ 0.0

WindowAgg (cost=347.69..423.59 rows=3,795 width=28) (actual rows= loops=)

105. 0.000 0.000 ↓ 0.0

Sort (cost=347.69..357.18 rows=3,795 width=28) (actual rows= loops=)

  • Sort Key: cession_cession_loan_2.cession_loan_id, cession_3.cession_date
106. 0.000 0.000 ↓ 0.0

Hash Join (cost=3.95..122.08 rows=3,795 width=28) (actual rows= loops=)

  • Hash Cond: (cession_cession_loan_2.cession_id = cession_3.cession_id)
107. 0.000 0.000 ↓ 0.0

Seq Scan on cession_cession_loan cession_cession_loan_2 (cost=0.00..65.95 rows=3,795 width=20) (actual rows= loops=)

108. 0.000 0.000 ↓ 0.0

Hash (cost=2.31..2.31 rows=131 width=16) (actual rows= loops=)

109. 0.000 0.000 ↓ 0.0

Seq Scan on cession cession_3 (cost=0.00..2.31 rows=131 width=16) (actual rows= loops=)

110. 0.000 0.000 ↓ 0.0

Hash (cost=2.31..2.31 rows=131 width=16) (actual rows= loops=)

111. 0.000 0.000 ↓ 0.0

Seq Scan on cession cession_2 (cost=0.00..2.31 rows=131 width=16) (actual rows= loops=)

112. 0.000 0.000 ↓ 0.0

Materialize (cost=36,397.37..37,859.47 rows=292,421 width=4) (actual rows= loops=)

113. 0.000 0.000 ↓ 0.0

Sort (cost=36,397.37..37,128.42 rows=292,421 width=4) (actual rows= loops=)

  • Sort Key: t_clcc.cession_loan_client_id
114. 0.000 0.000 ↓ 0.0

CTE Scan on t_clcc (cost=0.00..5,848.42 rows=292,421 width=4) (actual rows= loops=)

115. 0.000 0.000 ↓ 0.0

Sort (cost=82.55..84.16 rows=643 width=12) (actual rows= loops=)

  • Sort Key: tnec.cession_loan_client_id
116. 0.000 0.000 ↓ 0.0

Subquery Scan on tnec (cost=39.70..52.56 rows=643 width=12) (actual rows= loops=)

117. 0.000 0.000 ↓ 0.0

HashAggregate (cost=39.70..46.13 rows=643 width=4) (actual rows= loops=)

  • Group Key: cession_loan_task.cession_loan_client_id
118.          

Initplan (for HashAggregate)

119. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_task_status (cost=0.00..1.06 rows=1 width=4) (actual rows= loops=)

  • Filter: ((id_title)::text = 'carried'::text)
120. 0.000 0.000 ↓ 0.0

Seq Scan on cession_loan_task (cost=0.00..34.36 rows=855 width=4) (actual rows= loops=)

  • Filter: (cession_loan_task_status_id <> $4)
121. 0.000 0.000 ↓ 0.0

Hash (cost=4.07..4.07 rows=107 width=13) (actual rows= loops=)

122. 0.000 0.000 ↓ 0.0

Seq Scan on installment_plan ip (cost=0.00..4.07 rows=107 width=13) (actual rows= loops=)

123.          

CTE r

124. 0.000 0.000 ↓ 0.0

Aggregate (cost=106,195.85..106,195.87 rows=1 width=0) (actual rows= loops=)

125. 0.000 0.000 ↓ 0.0

CTE Scan on s s_1 (cost=0.00..84,956.68 rows=4,247,834 width=0) (actual rows= loops=)

126.          

Initplan (for Limit)

127. 0.000 0.000 ↓ 0.0

CTE Scan on r r_1 (cost=0.00..0.02 rows=1 width=32) (actual rows= loops=)

128. 0.000 0.000 ↓ 0.0

CTE Scan on r r_2 (cost=0.00..0.02 rows=1 width=8) (actual rows= loops=)

129. 0.000 0.000 ↓ 0.0

CTE Scan on r r_3 (cost=0.00..0.02 rows=1 width=32) (actual rows= loops=)

130. 0.000 0.000 ↓ 0.0

WindowAgg (cost=0.00..138,054.61 rows=4,247,834 width=649) (actual rows= loops=)

131. 0.000 0.000 ↓ 0.0

CTE Scan on s (cost=0.00..84,956.68 rows=4,247,834 width=649) (actual rows= loops=)