explain.depesz.com

PostgreSQL's explain analyze made readable

Result: acD5 : Query

Settings
# exclusive inclusive rows x rows loops node
1. 29.986 201,279.844 ↓ 3.8 27,309 1

Unique (cost=474,419.58..474,973.63 rows=7,149 width=2,698) (actual time=201,230.463..201,279.844 rows=27,309 loops=1)

  • Buffers: shared hit=1,113,692 dirtied=3, temp read=1,710 written=1,719
  • Functions: 123
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 20.135 ms, Inlining 0.000 ms, Optimization 11.798 ms, Emission 164.642 ms, Total 196.575 ms"Execution Time: 201,303.908 ms
2. 149.035 201,249.858 ↓ 3.8 27,309 1

Sort (cost=474,419.58..474,437.45 rows=7,149 width=2,698) (actual time=201,230.460..201,249.858 rows=27,309 loops=1)

  • Sort Key: "*SELECT* 1".fact_acct_id, "*SELECT* 1".saldosa, ((0)::numeric), ((0)::numeric), "*SELECT* 1".saldof, "*SELECT* 1".documentno, "*SELECT* 1".record_id, "*SELECT* 1".c_period_id, "*SELECT* 1".name1, "*SELECT* 1".dateacct, "*SELECT* 1".amtacctdr, "*SELECT* 1".amtacctcr, "*SELECT* 1".saldos, "*SELECT* 1".description1, "*SELECT* 1".account_id, "*SELECT* 1".gr1, "*SELECT* 1".name9, "*SELECT* 1".gr2, "*SELECT* 1".name10, "*SELECT* 1".gr3, "*SELECT* 1".name11, "*SELECT* 1".gr4, "*SELECT* 1".name12, "*SELECT* 1".value0, "*SELECT* 1".name13, "*SELECT* 1".description2, "*SELECT* 1".ad_table_id, "*SELECT* 1".tablename, "*SELECT* 1".name3, "*SELECT* 1".empre99
  • Sort Method: external merge Disk: 8,928kB
  • Buffers: shared hit=1,113,692 dirtied=3, temp read=1,710 written=1,719
3. 14.098 201,100.823 ↓ 3.8 27,309 1

Append (cost=208.52..464,199.82 rows=7,149 width=2,698) (actual time=189.853..201,100.823 rows=27,309 loops=1)

  • Buffers: shared hit=1,113,692 dirtied=3
4. 9.949 43,126.548 ↓ 1.1 7,847 1

Subquery Scan on *SELECT* 1 (cost=208.52..242,012.24 rows=7,043 width=1,092) (actual time=189.851..43,126.548 rows=7,847 loops=1)

  • Buffers: shared hit=310,163 dirtied=3
5. 41,110.910 43,116.599 ↓ 1.1 7,847 1

Hash Left Join (cost=208.52..241,906.60 rows=7,043 width=1,036) (actual time=189.848..43,116.599 rows=7,847 loops=1)

  • Hash Cond: (f.c_period_id = per.c_period_id)
  • Buffers: shared hit=310,163 dirtied=3
6. 19.724 867.477 ↓ 1.1 7,847 1

Hash Join (cost=169.92..169,236.10 rows=7,043 width=278) (actual time=180.965..867.477 rows=7,847 loops=1)

  • Hash Cond: (f.account_id = ce.c_elementvalue_id)
  • Buffers: shared hit=54,223 dirtied=3
7. 25.221 847.067 ↑ 8.6 7,847 1

Merge Left Join (cost=6.14..168,747.77 rows=67,767 width=148) (actual time=180.265..847.067 rows=7,847 loops=1)

  • Merge Cond: (f.ad_table_id = ad.ad_table_id)
  • Buffers: shared hit=54,181 dirtied=3
8. 821.737 821.737 ↑ 8.6 7,847 1

Index Scan using fact_acct_table_record on fact_acct f (cost=0.43..167,844.00 rows=67,767 width=115) (actual time=180.141..821.737 rows=7,847 loops=1)

  • Index Cond: (ad_client_id = '1000001'::numeric)
  • Filter: ((isactive = 'Y'::bpchar) AND (trunc((dateacct)::timestamp with time zone) < to_date('2019-01-01'::text, 'YYYY-MM-DD'::text)))
  • Rows Removed by Filter: 202,824
  • Buffers: shared hit=54,105 dirtied=3
9. 0.109 0.109 ↑ 9.9 128 1

Index Scan using ad_table_pkey on ad_table ad (cost=0.28..91.76 rows=1,272 width=38) (actual time=0.017..0.109 rows=128 loops=1)

  • Buffers: shared hit=76
10. 0.196 0.686 ↓ 1.0 633 1

Hash (cost=155.88..155.88 rows=632 width=158) (actual time=0.685..0.686 rows=633 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 71kB
  • Buffers: shared hit=42
11. 0.187 0.490 ↓ 1.0 633 1

Nested Loop (cost=9.58..155.88 rows=632 width=158) (actual time=0.166..0.490 rows=633 loops=1)

  • Buffers: shared hit=42
12. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on ad_client cl (cost=0.00..1.07 rows=1 width=114) (actual time=0.012..0.013 rows=1 loops=1)

  • Filter: (ad_client_id = '1000001'::numeric)
  • Rows Removed by Filter: 5
  • Buffers: shared hit=1
13. 0.155 0.290 ↓ 1.0 633 1

Bitmap Heap Scan on c_elementvalue ce (cost=9.58..148.48 rows=632 width=44) (actual time=0.145..0.290 rows=633 loops=1)

  • Recheck Cond: (c_element_id = '1000001'::numeric)
  • Heap Blocks: exact=20
  • Buffers: shared hit=41
14. 0.135 0.135 ↓ 1.8 1,153 1

Bitmap Index Scan on c_elementvalue_value (cost=0.00..9.42 rows=632 width=0) (actual time=0.135..0.135 rows=1,153 loops=1)

  • Index Cond: (c_element_id = '1000001'::numeric)
  • Buffers: shared hit=8
15. 0.184 0.397 ↑ 1.2 770 1

Hash (cost=26.60..26.60 rows=960 width=14) (actual time=0.397..0.397 rows=770 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 44kB
  • Buffers: shared hit=17
16. 0.213 0.213 ↑ 1.2 770 1

Seq Scan on c_period per (cost=0.00..26.60 rows=960 width=14) (actual time=0.009..0.213 rows=770 loops=1)

  • Buffers: shared hit=17
17.          

SubPlan (for Hash Left Join)

18. 109.858 109.858 ↑ 1.0 1 7,847

Index Scan using c_elementvalue_description on c_elementvalue ev (cost=0.28..2.51 rows=1 width=25) (actual time=0.010..0.014 rows=1 loops=7,847)

  • Index Cond: ((description)::text = '1'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 2) = "substring"((ce.value)::text, 1, 2)))
  • Rows Removed by Filter: 7
  • Buffers: shared hit=23,541
19. 149.093 149.093 ↑ 1.0 1 7,847

Index Scan using c_elementvalue_description on c_elementvalue ev_1 (cost=0.28..2.51 rows=1 width=25) (actual time=0.012..0.019 rows=1 loops=7,847)

  • Index Cond: ((description)::text = '2'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 4) = "substring"((ce.value)::text, 1, 4)))
  • Rows Removed by Filter: 16
  • Buffers: shared hit=54,929
20. 266.798 266.798 ↑ 1.0 1 7,847

Index Scan using c_elementvalue_description on c_elementvalue ev_2 (cost=0.28..2.51 rows=1 width=25) (actual time=0.010..0.034 rows=1 loops=7,847)

  • Index Cond: ((description)::text = '3'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 7) = "substring"((ce.value)::text, 1, 7)))
  • Rows Removed by Filter: 42
  • Buffers: shared hit=47,082
21. 612.066 612.066 ↑ 1.0 1 7,847

Index Scan using c_elementvalue_description on c_elementvalue ev_3 (cost=0.28..2.51 rows=1 width=25) (actual time=0.042..0.078 rows=1 loops=7,847)

  • Index Cond: ((description)::text = '4'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 10) = "substring"((ce.value)::text, 1, 10)))
  • Rows Removed by Filter: 100
  • Buffers: shared hit=94,164
22. 24.457 157,960.177 ↓ 183.6 19,462 1

Subquery Scan on *SELECT* 2 (cost=164.76..222,151.83 rows=106 width=1,036) (actual time=9.350..157,960.177 rows=19,462 loops=1)

  • Buffers: shared hit=803,529
23. 153,503.060 157,935.720 ↓ 183.6 19,462 1

Hash Join (cost=164.76..222,150.50 rows=106 width=1,008) (actual time=9.347..157,935.720 rows=19,462 loops=1)

  • Hash Cond: (f_1.account_id = ce_1.c_elementvalue_id)
  • Buffers: shared hit=803,529
24. 59.726 1,551.608 ↓ 19.1 19,462 1

Nested Loop Left Join (cost=0.98..220,889.26 rows=1,017 width=156) (actual time=1.401..1,551.608 rows=19,462 loops=1)

  • Buffers: shared hit=170,878
25. 90.660 1,414.034 ↓ 19.1 19,462 1

Nested Loop Left Join (cost=0.71..220,516.73 rows=1,017 width=123) (actual time=1.385..1,414.034 rows=19,462 loops=1)

  • Buffers: shared hit=112,492
26. 1,226.064 1,226.064 ↓ 19.1 19,462 1

Index Scan using fact_acct_table_record on fact_acct f_1 (cost=0.43..220,194.00 rows=1,017 width=115) (actual time=1.363..1,226.064 rows=19,462 loops=1)

  • Index Cond: (ad_client_id = '1000001'::numeric)
  • Filter: ((isactive = 'Y'::bpchar) AND (trunc((dateacct)::timestamp with time zone) >= to_date('2019-01-01'::text, 'YYYY-MM-DD'::text)) AND (trunc((dateacct)::timestamp with time zone) <= to_date('2019-01-31'::text, 'YYYY-MM-DD'::text)))
  • Rows Removed by Filter: 191,209
  • Buffers: shared hit=54,106
27. 97.310 97.310 ↑ 1.0 1 19,462

Index Scan using c_period_pkey on c_period per_1 (cost=0.28..0.32 rows=1 width=14) (actual time=0.005..0.005 rows=1 loops=19,462)

  • Index Cond: (c_period_id = f_1.c_period_id)
  • Buffers: shared hit=58,386
28. 77.848 77.848 ↑ 1.0 1 19,462

Index Scan using ad_table_pkey on ad_table ad_1 (cost=0.28..0.37 rows=1 width=38) (actual time=0.004..0.004 rows=1 loops=19,462)

  • Index Cond: (ad_table_id = f_1.ad_table_id)
  • Buffers: shared hit=58,386
29. 0.194 0.676 ↓ 1.0 633 1

Hash (cost=155.88..155.88 rows=632 width=158) (actual time=0.676..0.676 rows=633 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 71kB
  • Buffers: shared hit=42
30. 0.182 0.482 ↓ 1.0 633 1

Nested Loop (cost=9.58..155.88 rows=632 width=158) (actual time=0.162..0.482 rows=633 loops=1)

  • Buffers: shared hit=42
31. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on ad_client cl_1 (cost=0.00..1.07 rows=1 width=114) (actual time=0.012..0.013 rows=1 loops=1)

  • Filter: (ad_client_id = '1000001'::numeric)
  • Rows Removed by Filter: 5
  • Buffers: shared hit=1
32. 0.154 0.287 ↓ 1.0 633 1

Bitmap Heap Scan on c_elementvalue ce_1 (cost=9.58..148.48 rows=632 width=44) (actual time=0.143..0.287 rows=633 loops=1)

  • Recheck Cond: (c_element_id = '1000001'::numeric)
  • Heap Blocks: exact=20
  • Buffers: shared hit=41
33. 0.133 0.133 ↓ 1.8 1,153 1

Bitmap Index Scan on c_elementvalue_value (cost=0.00..9.42 rows=632 width=0) (actual time=0.133..0.133 rows=1,153 loops=1)

  • Index Cond: (c_element_id = '1000001'::numeric)
  • Buffers: shared hit=8
34.          

SubPlan (for Hash Join)

35. 291.930 291.930 ↑ 1.0 1 19,462

Index Scan using c_elementvalue_description on c_elementvalue ev_4 (cost=0.28..2.51 rows=1 width=25) (actual time=0.012..0.015 rows=1 loops=19,462)

  • Index Cond: ((description)::text = '1'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 2) = "substring"((ce_1.value)::text, 1, 2)))
  • Rows Removed by Filter: 7
  • Buffers: shared hit=58,386
36. 369.778 369.778 ↑ 1.0 1 19,462

Index Scan using c_elementvalue_description on c_elementvalue ev_5 (cost=0.28..2.51 rows=1 width=25) (actual time=0.012..0.019 rows=1 loops=19,462)

  • Index Cond: ((description)::text = '2'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 4) = "substring"((ce_1.value)::text, 1, 4)))
  • Rows Removed by Filter: 16
  • Buffers: shared hit=136,234
37. 681.170 681.170 ↑ 1.0 1 19,462

Index Scan using c_elementvalue_description on c_elementvalue ev_6 (cost=0.28..2.51 rows=1 width=25) (actual time=0.013..0.035 rows=1 loops=19,462)

  • Index Cond: ((description)::text = '3'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 7) = "substring"((ce_1.value)::text, 1, 7)))
  • Rows Removed by Filter: 42
  • Buffers: shared hit=116,772
38. 1,537.498 1,537.498 ↑ 1.0 1 19,462

Index Scan using c_elementvalue_description on c_elementvalue ev_7 (cost=0.28..2.51 rows=1 width=25) (actual time=0.032..0.079 rows=1 loops=19,462)

  • Index Cond: ((description)::text = '4'::text)
  • Filter: ((c_element_id = '1000001'::numeric) AND ("substring"((value)::text, 1, 10) = "substring"((ce_1.value)::text, 1, 10)))
  • Rows Removed by Filter: 100
  • Buffers: shared hit=233,544