explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AacB

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

GroupAggregate (cost=6,885,594.96..6,885,595.03 rows=1 width=132) (actual rows= loops=)

  • Group Key: ph_1.settlement, n_1.ware_id, n_1.brand_id, n_1.ware_name, (count(r.check_id))
2. 0.000 0.000 ↓ 0.0

Sort (cost=6,885,594.96..6,885,594.97 rows=1 width=164) (actual rows= loops=)

  • Sort Key: ph_1.settlement, n_1.ware_id, n_1.brand_id, n_1.ware_name, (count(r.check_id))
3. 0.000 0.000 ↓ 0.0

Merge Join (cost=6,885,594.63..6,885,594.95 rows=1 width=164) (actual rows= loops=)

  • Merge Cond: (((ph.settlement)::text = (ph_2.settlement)::text) AND (n.ware_id = n_1.ware_id))
  • Join Filter: (n_1.brand_id = n.brand_id)
4. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=354,993.43..354,993.53 rows=2 width=32) (actual rows= loops=)

  • Group Key: ph.settlement, n.ware_id, n.brand_id
5. 0.000 0.000 ↓ 0.0

Group (cost=354,993.43..354,993.47 rows=2 width=44) (actual rows= loops=)

  • Group Key: ph.settlement, n.ware_id, n.brand_id, r.check_id, r.check_time, r.check_date
6. 0.000 0.000 ↓ 0.0

Sort (cost=354,993.43..354,993.44 rows=2 width=44) (actual rows= loops=)

  • Sort Key: ph.settlement, n.ware_id, n.brand_id, r.check_id, r.check_time, r.check_date
7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=138.48..354,993.42 rows=2 width=44) (actual rows= loops=)

  • Join Filter: (n.nom_id = r.nom_id)
8. 0.000 0.000 ↓ 0.0

Hash Join (cost=123.58..349,627.53 rows=50,394 width=40) (actual rows= loops=)

  • Hash Cond: (r.pharmacy_id = ph.pharmacy_id)
9. 0.000 0.000 ↓ 0.0

Append (cost=0.00..345,866.60 rows=835,708 width=28) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Seq Scan on retail r (cost=0.00..0.00 rows=1 width=28) (actual rows= loops=)

  • Filter: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
11. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2020q3 r_1 (cost=8,596.00..345,866.60 rows=835,707 width=28) (actual rows= loops=)

  • Recheck Cond: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
12. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2020q3_check_date_idx (cost=0.00..8,387.07 rows=835,707 width=0) (actual rows= loops=)

  • Index Cond: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
13. 0.000 0.000 ↓ 0.0

Hash (cost=122.52..122.52 rows=85 width=20) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.27..122.52 rows=85 width=20) (actual rows= loops=)

  • Hash Cond: ((ph.settlement)::text = (lsrp.settlement)::text)
15. 0.000 0.000 ↓ 0.0

Seq Scan on pharmacy ph (cost=0.00..115.11 rows=1,411 width=20) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Hash (cost=1.12..1.12 rows=12 width=17) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Seq Scan on list_settlement_report_pair lsrp (cost=0.00..1.12 rows=12 width=17) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Materialize (cost=14.90..3,854.08 rows=2 width=12) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Hash Join (cost=14.90..3,854.07 rows=2 width=12) (actual rows= loops=)

  • Hash Cond: ((n.ware_id = lwbrp.ware_id) AND (n.brand_id = lwbrp.brand_id))
20. 0.000 0.000 ↓ 0.0

Seq Scan on nomenclature n (cost=0.00..2,941.46 rows=59,846 width=12) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Hash (cost=8.96..8.96 rows=396 width=16) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Seq Scan on list_ware_id_brand_id_report_pair lwbrp (cost=0.00..8.96 rows=396 width=16) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Materialize (cost=6,530,601.19..6,530,601.38 rows=1 width=172) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Merge Join (cost=6,530,601.19..6,530,601.37 rows=1 width=172) (actual rows= loops=)

  • Merge Cond: ((ph_1.settlement)::text = (ph_2.settlement)::text)
  • Join Filter: ((r_2.check_id = r_4.check_id) AND (r_2.check_date = r_4.check_date) AND (r_2.check_time = r_4.check_time))
25. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=355,005.52..355,005.61 rows=2 width=140) (actual rows= loops=)

  • Group Key: ph_1.settlement, n_1.ware_id, n_1.ware_name, n_1.brand_id, r_2.check_id, r_2.check_time, r_2.check_date
26. 0.000 0.000 ↓ 0.0

Sort (cost=355,005.52..355,005.53 rows=2 width=148) (actual rows= loops=)

  • Sort Key: ph_1.settlement, n_1.ware_id, n_1.ware_name, n_1.brand_id, r_2.check_id, r_2.check_time, r_2.check_date
27. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=138.91..355,005.51 rows=2 width=148) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Nested Loop (cost=138.48..354,993.42 rows=2 width=148) (actual rows= loops=)

  • Join Filter: (n_1.nom_id = r_2.nom_id)
29. 0.000 0.000 ↓ 0.0

Hash Join (cost=123.58..349,627.53 rows=50,394 width=76) (actual rows= loops=)

  • Hash Cond: (r_2.pharmacy_id = ph_1.pharmacy_id)
30. 0.000 0.000 ↓ 0.0

Append (cost=0.00..345,866.60 rows=835,708 width=64) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Seq Scan on retail r_2 (cost=0.00..0.00 rows=1 width=64) (actual rows= loops=)

  • Filter: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
32. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2020q3 r_3 (cost=8,596.00..345,866.60 rows=835,707 width=64) (actual rows= loops=)

  • Recheck Cond: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
33. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2020q3_check_date_idx (cost=0.00..8,387.07 rows=835,707 width=0) (actual rows= loops=)

  • Index Cond: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
34. 0.000 0.000 ↓ 0.0

Hash (cost=122.52..122.52 rows=85 width=20) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.27..122.52 rows=85 width=20) (actual rows= loops=)

  • Hash Cond: ((ph_1.settlement)::text = (lsrp_1.settlement)::text)
36. 0.000 0.000 ↓ 0.0

Seq Scan on pharmacy ph_1 (cost=0.00..115.11 rows=1,411 width=20) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Hash (cost=1.12..1.12 rows=12 width=17) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Seq Scan on list_settlement_report_pair lsrp_1 (cost=0.00..1.12 rows=12 width=17) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Materialize (cost=14.90..3,854.08 rows=2 width=80) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Hash Join (cost=14.90..3,854.07 rows=2 width=80) (actual rows= loops=)

  • Hash Cond: ((n_1.ware_id = lwbrp_1.ware_id) AND (n_1.brand_id = lwbrp_1.brand_id))
41. 0.000 0.000 ↓ 0.0

Seq Scan on nomenclature n_1 (cost=0.00..2,941.46 rows=59,846 width=80) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Hash (cost=8.96..8.96 rows=396 width=16) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Seq Scan on list_ware_id_brand_id_report_pair lwbrp_1 (cost=0.00..8.96 rows=396 width=16) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Index Scan using ware_part_for_working_wps_idx on warepart_for_working wfp (cost=0.43..6.04 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (wps = r_2.wps)
45. 0.000 0.000 ↓ 0.0

Materialize (cost=6,175,595.67..6,175,595.72 rows=1 width=72) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=6,175,595.67..6,175,595.71 rows=1 width=72) (actual rows= loops=)

  • Group Key: ph_2.settlement, r_4.check_id, r_4.check_date, r_4.check_time, (count(r1.ware_id))
47. 0.000 0.000 ↓ 0.0

Sort (cost=6,175,595.67..6,175,595.67 rows=1 width=80) (actual rows= loops=)

  • Sort Key: ph_2.settlement, r_4.check_id, r_4.check_date, r_4.check_time, (count(r1.ware_id))
48. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=354,994.21..6,175,595.66 rows=1 width=80) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=354,993.78..6,175,589.61 rows=1 width=80) (actual rows= loops=)

  • Join Filter: ((ph_2.settlement)::text = (lsrp_2.settlement)::text)
50. 0.000 0.000 ↓ 0.0

Nested Loop (cost=354,993.78..6,175,588.34 rows=1 width=80) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Nested Loop (cost=354,993.50..6,175,582.67 rows=1 width=68) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=354,993.50..354,993.55 rows=2 width=44) (actual rows= loops=)

  • Group Key: r1.settlement, r1.check_id, r1.check_date, r1.check_time
53. 0.000 0.000 ↓ 0.0

Sort (cost=354,993.50..354,993.50 rows=2 width=40) (actual rows= loops=)

  • Sort Key: r1.settlement, r1.check_id, r1.check_date, r1.check_time
54. 0.000 0.000 ↓ 0.0

Subquery Scan on r1 (cost=354,993.43..354,993.49 rows=2 width=40) (actual rows= loops=)

55. 0.000 0.000 ↓ 0.0

Group (cost=354,993.43..354,993.47 rows=2 width=44) (actual rows= loops=)

  • Group Key: ph_3.settlement, n_2.ware_id, n_2.brand_id, r_19.check_id, r_19.check_time, r_19.check_date
56. 0.000 0.000 ↓ 0.0

Sort (cost=354,993.43..354,993.44 rows=2 width=44) (actual rows= loops=)

  • Sort Key: ph_3.settlement, n_2.ware_id, n_2.brand_id, r_19.check_id, r_19.check_time, r_19.check_date
57. 0.000 0.000 ↓ 0.0

Nested Loop (cost=138.48..354,993.42 rows=2 width=44) (actual rows= loops=)

  • Join Filter: (n_2.nom_id = r_19.nom_id)
58. 0.000 0.000 ↓ 0.0

Hash Join (cost=123.58..349,627.53 rows=50,394 width=40) (actual rows= loops=)

  • Hash Cond: (r_19.pharmacy_id = ph_3.pharmacy_id)
59. 0.000 0.000 ↓ 0.0

Append (cost=0.00..345,866.60 rows=835,708 width=28) (actual rows= loops=)

60. 0.000 0.000 ↓ 0.0

Seq Scan on retail r_19 (cost=0.00..0.00 rows=1 width=28) (actual rows= loops=)

  • Filter: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
61. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2020q3 r_20 (cost=8,596.00..345,866.60 rows=835,707 width=28) (actual rows= loops=)

  • Recheck Cond: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
62. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2020q3_check_date_idx (cost=0.00..8,387.07 rows=835,707 width=0) (actual rows= loops=)

  • Index Cond: ((check_date >= '2020-09-11'::date) AND (check_date <= '2020-09-14'::date))
63. 0.000 0.000 ↓ 0.0

Hash (cost=122.52..122.52 rows=85 width=20) (actual rows= loops=)

64. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.27..122.52 rows=85 width=20) (actual rows= loops=)

  • Hash Cond: ((ph_3.settlement)::text = (lsrp_3.settlement)::text)
65. 0.000 0.000 ↓ 0.0

Seq Scan on pharmacy ph_3 (cost=0.00..115.11 rows=1,411 width=20) (actual rows= loops=)

66. 0.000 0.000 ↓ 0.0

Hash (cost=1.12..1.12 rows=12 width=17) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

Seq Scan on list_settlement_report_pair lsrp_3 (cost=0.00..1.12 rows=12 width=17) (actual rows= loops=)

68. 0.000 0.000 ↓ 0.0

Materialize (cost=14.90..3,854.08 rows=2 width=12) (actual rows= loops=)

69. 0.000 0.000 ↓ 0.0

Hash Join (cost=14.90..3,854.07 rows=2 width=12) (actual rows= loops=)

  • Hash Cond: ((n_2.ware_id = lwbrp_2.ware_id) AND (n_2.brand_id = lwbrp_2.brand_id))
70. 0.000 0.000 ↓ 0.0

Seq Scan on nomenclature n_2 (cost=0.00..2,941.46 rows=59,846 width=12) (actual rows= loops=)

71. 0.000 0.000 ↓ 0.0

Hash (cost=8.96..8.96 rows=396 width=16) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Seq Scan on list_ware_id_brand_id_report_pair lwbrp_2 (cost=0.00..8.96 rows=396 width=16) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Append (cost=0.00..2,910,294.40 rows=15 width=60) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

Seq Scan on retail r_4 (cost=0.00..0.00 rows=1 width=60) (actual rows= loops=)

  • Filter: ((r1.check_id = check_id) AND (r1.check_date = check_date) AND (r1.check_time = check_time))
75. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2018q2 r_5 (cost=1,427.41..128,902.03 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
76. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2018q2_check_date_idx (cost=0.00..1,427.41 rows=186,321 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
77. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2018q3 r_6 (cost=1,469.42..291,486.07 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
78. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2018q3_check_date_idx (cost=0.00..1,469.41 rows=186,322 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
79. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2018q4 r_7 (cost=1,630.89..323,913.90 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
80. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2018q4_check_date_idx (cost=0.00..1,630.89 rows=207,052 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
81. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2019q1 r_8 (cost=1,802.51..356,670.66 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
82. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2019q1_check_date_idx (cost=0.00..1,802.51 rows=229,935 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
83. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2019q2 r_9 (cost=1,611.55..320,341.13 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
84. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2019q2_check_date_idx (cost=0.00..1,611.55 rows=204,473 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
85. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2019q3 r_10 (cost=1,521.36..307,821.09 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
86. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2019q3_check_date_idx (cost=0.00..1,521.36 rows=193,248 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
87. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2019q4 r_11 (cost=1,573.79..315,876.57 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
88. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2019q4_check_date_idx (cost=0.00..1,573.79 rows=199,438 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
89. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2020q1 r_12 (cost=1,738.24..349,114.05 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
90. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2020q1_check_date_idx (cost=0.00..1,738.24 rows=221,365 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
91. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2020q2 r_13 (cost=1,290.63..255,871.43 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
92. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2020q2_check_date_idx (cost=0.00..1,290.63 rows=164,084 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
93. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on retail_p2020q3 r_14 (cost=1,349.95..260,225.98 rows=1 width=60) (actual rows= loops=)

  • Recheck Cond: (check_date = r1.check_date)
  • Filter: ((r1.check_id = check_id) AND (r1.check_time = check_time))
94. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on retail_p2020q3_check_date_idx (cost=0.00..1,349.95 rows=171,994 width=0) (actual rows= loops=)

  • Index Cond: (check_date = r1.check_date)
95. 0.000 0.000 ↓ 0.0

Seq Scan on retail_p2020q4 r_15 (cost=0.00..17.88 rows=1 width=60) (actual rows= loops=)

  • Filter: ((r1.check_id = check_id) AND (r1.check_date = check_date) AND (r1.check_time = check_time))
96. 0.000 0.000 ↓ 0.0

Seq Scan on retail_p2021q1 r_16 (cost=0.00..17.88 rows=1 width=60) (actual rows= loops=)

  • Filter: ((r1.check_id = check_id) AND (r1.check_date = check_date) AND (r1.check_time = check_time))
97. 0.000 0.000 ↓ 0.0

Seq Scan on retail_p2021q2 r_17 (cost=0.00..17.88 rows=1 width=60) (actual rows= loops=)

  • Filter: ((r1.check_id = check_id) AND (r1.check_date = check_date) AND (r1.check_time = check_time))
98. 0.000 0.000 ↓ 0.0

Seq Scan on retail_p2021q3 r_18 (cost=0.00..17.88 rows=1 width=60) (actual rows= loops=)

  • Filter: ((r1.check_id = check_id) AND (r1.check_date = check_date) AND (r1.check_time = check_time))
99. 0.000 0.000 ↓ 0.0

Index Scan using pharmacy_pharmacy_id_idx on pharmacy ph_2 (cost=0.28..5.66 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (pharmacy_id = r_4.pharmacy_id)
100. 0.000 0.000 ↓ 0.0

Seq Scan on list_settlement_report_pair lsrp_2 (cost=0.00..1.12 rows=12 width=17) (actual rows= loops=)

101. 0.000 0.000 ↓ 0.0

Index Scan using ware_part_for_working_wps_idx on warepart_for_working wfp_1 (cost=0.43..6.03 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (wps = r_4.wps)