explain.depesz.com

PostgreSQL's explain analyze made readable

Result: n8ST : Query

Settings
# exclusive inclusive rows x rows loops node
1. 35.004 203,085.072 ↓ 3.8 27,309 1

Unique (cost=474,398.03..474,952.07 rows=7,149 width=2,698) (actual time=203,032.227..203,085.072 rows=27,309 loops=1)

  • Buffers: shared hit=1,113,679 dirtied=2, temp read=1,710 written=1,719
  • Functions: 123
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 33.043 ms, Inlining 0.000 ms, Optimization 15.820 ms, Emission 184.004 ms, Total 232.867 ms"Execution Time: 203,122.325 ms
2. 148.055 203,050.068 ↓ 3.8 27,309 1

Sort (cost=474,398.03..474,415.90 rows=7,149 width=2,698) (actual time=203,032.225..203,050.068 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,679 dirtied=2, temp read=1,710 written=1,719
3. 13.784 202,902.013 ↓ 3.8 27,309 1

Append (cost=208.52..464,178.26 rows=7,149 width=2,698) (actual time=215.169..202,902.013 rows=27,309 loops=1)

  • Buffers: shared hit=1,113,679 dirtied=2
4. 9.421 43,985.109 ↓ 1.1 7,847 1

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

  • Buffers: shared hit=310,157 dirtied=2
5. 41,965.131 43,975.688 ↓ 1.1 7,847 1

Hash Left Join (cost=208.52..241,897.50 rows=7,043 width=1,036) (actual time=215.164..43,975.688 rows=7,847 loops=1)

  • Hash Cond: (f.c_period_id = per.c_period_id)
  • Buffers: shared hit=310,157 dirtied=2
6. 21.961 856.677 ↓ 1.1 7,847 1

Hash Join (cost=169.92..169,227.00 rows=7,043 width=278) (actual time=205.503..856.677 rows=7,847 loops=1)

  • Hash Cond: (f.account_id = ce.c_elementvalue_id)
  • Buffers: shared hit=54,217 dirtied=2
7. 24.597 833.986 ↑ 8.6 7,847 1

Merge Left Join (cost=6.14..168,738.69 rows=67,763 width=148) (actual time=202.033..833.986 rows=7,847 loops=1)

  • Merge Cond: (f.ad_table_id = ad.ad_table_id)
  • Buffers: shared hit=54,175 dirtied=2
8. 809.290 809.290 ↑ 8.6 7,847 1

Index Scan using fact_acct_table_record on fact_acct f (cost=0.43..167,834.96 rows=67,763 width=115) (actual time=201.917..809.290 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,816
  • Buffers: shared hit=54,099 dirtied=2
9. 0.099 0.099 ↑ 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.015..0.099 rows=128 loops=1)

  • Buffers: shared hit=76
10. 0.250 0.730 ↓ 1.0 633 1

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

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

Nested Loop (cost=9.58..155.88 rows=632 width=158) (actual time=0.160..0.480 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.153 0.284 ↓ 1.0 633 1

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

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

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

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

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

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

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

  • Buffers: shared hit=17
17.          

SubPlan (for Hash Left Join)

18. 117.705 117.705 ↑ 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.015 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. 274.645 274.645 ↑ 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.035 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.386 158,903.120 ↓ 183.6 19,462 1

Subquery Scan on *SELECT* 2 (cost=164.76..222,139.37 rows=106 width=1,036) (actual time=11.149..158,903.120 rows=19,462 loops=1)

  • Buffers: shared hit=803,522
23. 154,496.676 158,878.734 ↓ 183.6 19,462 1

Hash Join (cost=164.76..222,138.05 rows=106 width=1,008) (actual time=11.147..158,878.734 rows=19,462 loops=1)

  • Hash Cond: (f_1.account_id = ce_1.c_elementvalue_id)
  • Buffers: shared hit=803,522
24. 62.970 1,500.971 ↓ 19.2 19,462 1

Nested Loop Left Join (cost=0.98..220,876.81 rows=1,016 width=156) (actual time=2.883..1,500.971 rows=19,462 loops=1)

  • Buffers: shared hit=170,871
25. 93.560 1,360.153 ↓ 19.2 19,462 1

Nested Loop Left Join (cost=0.71..220,504.58 rows=1,016 width=123) (actual time=2.863..1,360.153 rows=19,462 loops=1)

  • Buffers: shared hit=112,485
26. 1,169.283 1,169.283 ↓ 19.2 19,462 1

Index Scan using fact_acct_table_record on fact_acct f_1 (cost=0.43..220,182.14 rows=1,016 width=115) (actual time=1.227..1,169.283 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,201
  • Buffers: shared hit=54,099
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.198 0.711 ↓ 1.0 633 1

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

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

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

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

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

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

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

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

Bitmap Index Scan on c_elementvalue_value (cost=0.00..9.42 rows=632 width=0) (actual time=0.131..0.131 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.011..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.011..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.014..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