explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ztf5 : WightedHoldingSector_BMK_40Sec

Settings
# exclusive inclusive rows x rows loops node
1. 0.034 45,323.819 ↑ 451,574.1 13 1

Sort (cost=3,782,141,012.25..3,782,155,688.41 rows=5,870,463 width=288) (actual time=45,323.818..45,323.819 rows=13 loops=1)

  • Sort Key: (COALESCE(sum(securities.acctmv), '0'::double precision)) DESC
  • Sort Method: quicksort Memory: 26kB
  • Buffers: shared hit=49,180 read=55,799, temp read=23 written=21
2.          

CTE accountholdingdate

3. 0.072 168.954 ↑ 79.0 1 1

GroupAggregate (cost=0.70..29.66 rows=79 width=28) (actual time=168.953..168.954 rows=1 loops=1)

  • Group Key: h.masterentityid, h.sourcecode
  • Buffers: shared hit=155 read=137
4. 168.882 168.882 ↓ 3.5 277 1

Index Only Scan using holding_pkey on holding h (cost=0.70..28.28 rows=79 width=28) (actual time=27.820..168.882 rows=277 loops=1)

  • Index Cond: ((effectivedate = '2020-07-31'::date) AND (masterentityid = '01CB0002XX'::text) AND (sourcecode = 'STARDIRECT'::text))
  • Heap Fetches: 5
  • Buffers: shared hit=155 read=137
5.          

CTE holdings

6. 0.563 1,772.027 ↑ 20.3 277 1

Nested Loop Left Join (cost=4.54..157,900.39 rows=5,625 width=87) (actual time=171.870..1,772.027 rows=277 loops=1)

  • Buffers: shared hit=1,373 read=2,010
7. 0.357 190.902 ↓ 1.9 277 1

Nested Loop (cost=0.70..3,052.48 rows=145 width=51) (actual time=169.891..190.902 rows=277 loops=1)

  • Buffers: shared hit=169 read=341
8. 168.957 168.957 ↑ 79.0 1 1

CTE Scan on accountholdingdate m (cost=0.00..1.58 rows=79 width=1,040) (actual time=168.956..168.957 rows=1 loops=1)

  • Buffers: shared hit=155 read=137
9. 21.588 21.588 ↓ 39.6 277 1

Index Scan using holding_pkey on holding h_1 (cost=0.70..38.55 rows=7 width=51) (actual time=0.929..21.588 rows=277 loops=1)

  • Index Cond: ((effectivedate = m.effectivedate) AND ((masterentityid)::text = (m.masterentityid)::text) AND ((sourcecode)::text = (m.sourcecode)::text))
  • Buffers: shared hit=14 read=204
10. 1.268 1,580.562 ↑ 39.0 1 277

Hash Left Join (cost=3.84..1,071.34 rows=39 width=40) (actual time=2.995..5.706 rows=1 loops=277)

  • Hash Cond: ((s.issuetypecode)::text = (cr.issuetypecode)::text)
  • Buffers: shared hit=1,204 read=1,669
11. 1,578.346 1,578.346 ↑ 39.0 1 277

Index Scan using ix_873765_securityreferencemaster on securityreferencemaster s (cost=0.56..1,067.79 rows=39 width=35) (actual time=2.988..5.698 rows=1 loops=277)

  • Index Cond: ((h_1.primaryissueid)::text = (primaryissueid)::text)
  • Filter: ((_seq = 1) AND (h_1.effectivedate >= _fromdate) AND (h_1.effectivedate <= _todate))
  • Rows Removed by Filter: 18
  • Buffers: shared hit=1,203 read=1,668
12. 0.014 0.948 ↑ 1.0 40 1

Hash (cost=2.78..2.78 rows=40 width=10) (actual time=0.948..0.948 rows=40 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=1 read=1
13. 0.934 0.934 ↑ 1.0 40 1

Seq Scan on securityglobalcashrule cr (cost=0.00..2.78 rows=40 width=10) (actual time=0.013..0.934 rows=40 loops=1)

  • Filter: ((_seq = 1) AND ((schemecode)::text = 'GLOBAL'::text))
  • Rows Removed by Filter: 12
  • Buffers: shared hit=1 read=1
14.          

CTE benchmark

15. 0.005 4.164 ↑ 14.0 1 1

Nested Loop (cost=0.41..615.70 rows=14 width=28) (actual time=4.160..4.164 rows=1 loops=1)

  • Buffers: shared read=4
16. 0.002 0.002 ↑ 79.0 1 1

CTE Scan on accountholdingdate a (cost=0.00..1.58 rows=79 width=516) (actual time=0.001..0.002 rows=1 loops=1)

17. 4.157 4.157 ↑ 1.0 1 1

Index Scan using accountbenchmarkrelationship_pkey on accountbenchmarkrelationship abr (cost=0.41..7.76 rows=1 width=28) (actual time=4.155..4.157 rows=1 loops=1)

  • Index Cond: (((masterentityid)::text = (a.masterentityid)::text) AND ((segmentcode)::text = 'TF'::text) AND (benchmarkordinalnumber = 14))
  • Buffers: shared read=4
18.          

CTE bmksources

19. 0.017 0.017 ↑ 33.3 3 1

Function Scan on unnest t (cost=0.00..1.25 rows=100 width=40) (actual time=0.016..0.017 rows=3 loops=1)

20.          

CTE bmksource

21. 1.450 191.296 ↑ 42,171.0 1 1

HashAggregate (cost=120,867.17..121,288.88 rows=42,171 width=26) (actual time=191.159..191.296 rows=1 loops=1)

  • Group Key: h_2.accountbenchmarkid, h_2.effectivedate
  • Buffers: shared hit=1 read=5,435
22. 1.373 189.846 ↑ 7.4 5,666 1

Hash Join (cost=3.82..120,550.89 rows=42,171 width=26) (actual time=9.619..189.846 rows=5,666 loops=1)

  • Hash Cond: ((h_2.sourcecode)::text = s_1.sourcecode)
  • Buffers: shared hit=1 read=5,435
23. 0.623 188.448 ↑ 7.4 5,666 1

Nested Loop (cost=0.57..119,967.79 rows=42,171 width=25) (actual time=9.577..188.448 rows=5,666 loops=1)

  • Buffers: shared hit=1 read=5,435
24. 4.170 4.170 ↑ 14.0 1 1

CTE Scan on benchmark b (cost=0.00..0.28 rows=14 width=516) (actual time=4.165..4.170 rows=1 loops=1)

  • Buffers: shared read=4
25. 183.655 183.655 ↓ 1.9 5,666 1

Index Only Scan using benchmarkconstituents_pkey on benchmarkconstituents h_2 (cost=0.57..8,538.99 rows=3,012 width=25) (actual time=5.406..183.655 rows=5,666 loops=1)

  • Index Cond: ((effectivedate = '2020-07-31'::date) AND (accountbenchmarkid = (b.benchmarkid)::text))
  • Heap Fetches: 5,666
  • Buffers: shared hit=1 read=5,431
26. 0.005 0.025 ↑ 33.3 3 1

Hash (cost=2.00..2.00 rows=100 width=40) (actual time=0.025..0.025 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
27. 0.020 0.020 ↑ 33.3 3 1

CTE Scan on bmksources s_1 (cost=0.00..2.00 rows=100 width=40) (actual time=0.018..0.020 rows=3 loops=1)

28.          

CTE bmkholdingdate

29. 0.043 191.348 ↑ 21,086.0 1 1

Hash Join (cost=3.25..1,215.67 rows=21,086 width=556) (actual time=191.210..191.348 rows=1 loops=1)

  • Hash Cond: (b_1.sortorder = bs.sortorder)
  • Buffers: shared hit=4 read=5,435
30. 191.298 191.298 ↑ 42,171.0 1 1

CTE Scan on bmksource b_1 (cost=0.00..843.42 rows=42,171 width=532) (actual time=191.161..191.298 rows=1 loops=1)

  • Buffers: shared hit=1 read=5,435
31. 0.005 0.007 ↑ 33.3 3 1

Hash (cost=2.00..2.00 rows=100 width=40) (actual time=0.006..0.007 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
32. 0.002 0.002 ↑ 33.3 3 1

CTE Scan on bmksources bs (cost=0.00..2.00 rows=100 width=40) (actual time=0.001..0.002 rows=3 loops=1)

33.          

CTE bmkholdings

34. 12.317 27,274.525 ↑ 255.6 5,666 1

Hash Left Join (cost=4.41..7,927,050.23 rows=1,448,212 width=140) (actual time=195.805..27,274.525 rows=5,666 loops=1)

  • Hash Cond: ((s_2.issuetypecode)::text = (cr_1.issuetypecode)::text)
  • Buffers: shared hit=29,301 read=40,552
35. 42.597 27,262.174 ↑ 255.6 5,666 1

Nested Loop Left Join (cost=1.13..7,913,321.46 rows=1,448,212 width=59) (actual time=195.747..27,262.174 rows=5,666 loops=1)

  • Join Filter: ((b_2.effectivedate >= s_2._fromdate) AND (b_2.effectivedate <= s_2._todate))
  • Rows Removed by Join Filter: 117,087
  • Buffers: shared hit=29,299 read=40,552
36. 4.671 209.755 ↑ 6.6 5,666 1

Nested Loop (cost=0.57..7,430,292.60 rows=37,303 width=56) (actual time=191.261..209.755 rows=5,666 loops=1)

  • Buffers: shared hit=76 read=5,435
37. 191.350 191.350 ↑ 21,086.0 1 1

CTE Scan on bmkholdingdate b_2 (cost=0.00..421.72 rows=21,086 width=556) (actual time=191.211..191.350 rows=1 loops=1)

  • Buffers: shared hit=4 read=5,435
38. 13.734 13.734 ↓ 26.5 5,666 1

Index Scan using benchmarkconstituents_pkey on benchmarkconstituents c (cost=0.57..350.22 rows=214 width=48) (actual time=0.045..13.734 rows=5,666 loops=1)

  • Index Cond: ((effectivedate = b_2.effectivedate) AND ((accountbenchmarkid)::text = (b_2.accountbenchmarkid)::text) AND ((sourcecode)::text = b_2.sourcecode))
  • Buffers: shared hit=72
39. 27,009.822 27,009.822 ↑ 15.9 22 5,666

Index Scan using ix_873765_securityreferencemaster on securityreferencemaster s_2 (cost=0.56..7.70 rows=350 width=35) (actual time=0.679..4.767 rows=22 loops=5,666)

  • Index Cond: ((c.cadisissueid)::text = (primaryissueid)::text)
  • Filter: (_seq = 1)
  • Buffers: shared hit=29,223 read=35,117
40. 0.014 0.034 ↑ 1.0 40 1

Hash (cost=2.78..2.78 rows=40 width=10) (actual time=0.034..0.034 rows=40 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=2
41. 0.020 0.020 ↑ 1.0 40 1

Seq Scan on securityglobalcashrule cr_1 (cost=0.00..2.78 rows=40 width=10) (actual time=0.005..0.020 rows=40 loops=1)

  • Filter: ((_seq = 1) AND ((schemecode)::text = 'GLOBAL'::text))
  • Rows Removed by Filter: 12
  • Buffers: shared hit=2
42.          

CTE sectors

43. 2.395 45,285.900 ↑ 28.2 5,763 1

Unique (cost=11,582,333.84..11,586,392.02 rows=162,327 width=1,740) (actual time=45,283.216..45,285.900 rows=5,763 loops=1)

  • Buffers: shared hit=49,171 read=55,799
44. 26.438 45,283.505 ↑ 27.3 5,943 1

Sort (cost=11,582,333.84..11,582,739.66 rows=162,327 width=1,740) (actual time=45,283.215..45,283.505 rows=5,943 loops=1)

  • Sort Key: h_3.primaryissueid, ascm.sectorclassificationlevel2desc, ascm.sectorclassificationlevel2desc, (''::text), (''::text), (''::text), (''::text), (''::text), (''::text)
  • Sort Method: quicksort Memory: 662kB
  • Buffers: shared hit=49,171 read=55,799
45. 2.770 45,257.067 ↑ 27.3 5,943 1

Append (cost=0.57..11,323,047.62 rows=162,327 width=1,740) (actual time=176.484..45,257.067 rows=5,943 loops=1)

  • Buffers: shared hit=49,171 read=55,799
46. 1.107 2,761.015 ↑ 550.4 277 1

Nested Loop (cost=0.57..313,723.54 rows=152,463 width=734) (actual time=176.483..2,761.015 rows=277 loops=1)

  • Buffers: shared hit=1,981 read=2,852
47. 1,772.680 1,772.680 ↑ 20.3 277 1

CTE Scan on holdings h_3 (cost=0.00..112.50 rows=5,625 width=524) (actual time=171.877..1,772.680 rows=277 loops=1)

  • Buffers: shared hit=1,373 read=2,010
48. 987.228 987.228 ↑ 27.0 1 277

Index Scan using securityclassificationmaster_scdindex on securityclassificationmaster ascm (cost=0.57..55.48 rows=27 width=36) (actual time=3.559..3.564 rows=1 loops=277)

  • Index Cond: (((sourcecode)::text = 'EAGLE'::text) AND ((primaryissueid)::text = (h_3.primaryissueid)::text) AND ((sectorclassificationschemacode)::text = 'IVZ_FI'::text) AND (h_3.effectivedate >= _fromdate) AND (h_3.effectivedate <= _todate))
  • Buffers: shared hit=608 read=842
49. 30.213 42,493.282 ↑ 1.7 5,666 1

Nested Loop (cost=0.57..11,007,700.81 rows=9,864 width=734) (actual time=198.384..42,493.282 rows=5,666 loops=1)

  • Buffers: shared hit=47,190 read=52,947
50. 27,289.521 27,289.521 ↑ 255.6 5,666 1

CTE Scan on bmkholdings c_1 (cost=0.00..28,964.24 rows=1,448,212 width=588) (actual time=195.808..27,289.521 rows=5,666 loops=1)

  • Buffers: shared hit=29,301 read=40,552
51. 15,173.548 15,173.548 ↑ 6.0 1 5,666

Index Scan using securityclassificationmaster_scdindex on securityclassificationmaster bscm (cost=0.57..7.52 rows=6 width=49) (actual time=2.670..2.678 rows=1 loops=5,666)

  • Index Cond: (((sourcecode)::text = c_1.sectorsource) AND ((primaryissueid)::text = (c_1.cadisissueid)::text) AND ((sectorclassificationschemacode)::text = c_1.sectorscheme) AND (c_1.effectivedate >= _fromdate) AND (c_1.effectivedate <= _todate))
  • Buffers: shared hit=17,889 read=12,395
52.          

CTE securities

53. 1.616 45,311.129 ↑ 197,558.9 5,943 1

Unique (cost=3,651,674,146.24..3,695,702,615.59 rows=1,174,092,516 width=1,344) (actual time=45,309.226..45,311.129 rows=5,943 loops=1)

  • Buffers: shared hit=49,177 read=55,799, temp read=23 written=21
54. 4.817 45,309.513 ↑ 197,558.9 5,943 1

Sort (cost=3,651,674,146.24..3,654,609,377.53 rows=1,174,092,516 width=1,344) (actual time=45,309.225..45,309.513 rows=5,943 loops=1)

  • Sort Key: h_4.masterentityid, h_4.effectivedate, h_4.issueclass, sa.id, sa.level1code, sa.level1name, sa.level2code, sa.level2name, sa.level3code, sa.level3name, sa.level4code, sa.level4name, (CASE WHEN ((h_4.issueclass)::text = 'EQUITY'::text) THEN h_4.marketvaluebaseamount ELSE (h_4.marketvaluebaseamount + h_4.accruedincomenetbaseamount) END), (((0))::double precision)
  • Sort Method: quicksort Memory: 1,028kB
  • Buffers: shared hit=49,177 read=55,799, temp read=23 written=21
55. 0.457 45,304.696 ↑ 197,558.9 5,943 1

Append (cost=8,770,504.65..43,678,707.39 rows=1,174,092,516 width=1,344) (actual time=45,289.248..45,304.696 rows=5,943 loops=1)

  • Buffers: shared hit=49,174 read=55,799, temp read=23 written=21
56. 0.052 45,289.370 ↑ 16,399.9 277 1

Result (cost=8,770,504.65..8,997,643.50 rows=4,542,777 width=1,344) (actual time=45,289.248..45,289.370 rows=277 loops=1)

  • Buffers: shared hit=49,174 read=55,799, temp read=23 written=21
57. 0.060 45,289.318 ↑ 16,399.9 277 1

Unique (cost=8,770,504.65..8,940,858.79 rows=4,542,777 width=1,340) (actual time=45,289.246..45,289.318 rows=277 loops=1)

  • Buffers: shared hit=49,174 read=55,799, temp read=23 written=21
58. 0.861 45,289.258 ↑ 16,399.9 277 1

Sort (cost=8,770,504.65..8,781,861.59 rows=4,542,777 width=1,340) (actual time=45,289.245..45,289.258 rows=277 loops=1)

  • Sort Key: h_4.masterentityid, h_4.effectivedate, h_4.issueclass, sa.id, sa.level1code, sa.level1name, sa.level2code, sa.level2name, sa.level3code, sa.level3name, sa.level4code, sa.level4name, (CASE WHEN ((h_4.issueclass)::text = 'EQUITY'::text) THEN h_4.marketvaluebaseamount ELSE (h_4.marketvaluebaseamount + h_4.accruedincomenetbaseamount) END), (0)
  • Sort Method: quicksort Memory: 63kB
  • Buffers: shared hit=49,174 read=55,799, temp read=23 written=21
59. 0.027 45,288.397 ↑ 16,399.9 277 1

Append (cost=956.52..302,789.34 rows=4,542,777 width=1,340) (actual time=45,283.475..45,288.397 rows=277 loops=1)

  • Buffers: shared hit=49,171 read=55,799, temp read=23 written=21
60. 1.224 45,288.331 ↑ 16,519.0 275 1

Hash Join (cost=956.52..257,206.60 rows=4,542,721 width=2,308) (actual time=45,283.474..45,288.331 rows=275 loops=1)

  • Hash Cond: ((sa.id)::text = (h_4.primaryissueid)::text)
  • Buffers: shared hit=49,171 read=55,799, temp read=23 written=21
61. 45,286.927 45,286.927 ↑ 28.2 5,763 1

CTE Scan on sectors sa (cost=0.00..3,246.54 rows=162,327 width=1,740) (actual time=45,283.218..45,286.927 rows=5,763 loops=1)

  • Buffers: shared hit=49,171 read=55,799
62. 0.119 0.180 ↑ 20.4 275 1

Hash (cost=126.56..126.56 rows=5,597 width=1,088) (actual time=0.180..0.180 rows=275 loops=1)

  • Buckets: 4,096 Batches: 2 Memory Usage: 45kB
  • Buffers: temp written=1
63. 0.061 0.061 ↑ 20.4 275 1

CTE Scan on holdings h_4 (cost=0.00..126.56 rows=5,597 width=1,088) (actual time=0.003..0.061 rows=275 loops=1)

  • Filter: ((issueclass)::text <> 'CASH'::text)
  • Rows Removed by Filter: 2
64. 0.039 0.039 ↑ 28.0 2 1

CTE Scan on holdings (cost=0.00..154.97 rows=56 width=1,340) (actual time=0.022..0.039 rows=2 loops=1)

  • Filter: (((issueclass)::text = 'CASH'::text) OR (((issueclass)::text = 'EQUITY'::text) AND (accruedincomenetbaseamount <> '0'::double precision)))
  • Rows Removed by Filter: 275
65. 0.698 14.309 ↑ 206,414.1 5,666 1

Subquery Scan on *SELECT* 3 (cost=2,481,555.85..34,648,388.60 rows=1,169,542,498 width=2,312) (actual time=7.407..14.309 rows=5,666 loops=1)

66. 5.104 13.611 ↑ 206,414.1 5,666 1

Merge Join (cost=2,481,555.85..20,029,107.38 rows=1,169,542,498 width=2,308) (actual time=7.406..13.611 rows=5,666 loops=1)

  • Merge Cond: ((sb.id)::text = (c_2.cadisissueid)::text)
67. 3.312 4.160 ↑ 28.2 5,763 1

Sort (cost=262,532.76..262,938.58 rows=162,327 width=1,740) (actual time=3.890..4.160 rows=5,763 loops=1)

  • Sort Key: sb.id
  • Sort Method: quicksort Memory: 648kB
68. 0.848 0.848 ↑ 28.2 5,763 1

CTE Scan on sectors sb (cost=0.00..3,246.54 rows=162,327 width=1,740) (actual time=0.001..0.848 rows=5,763 loops=1)

69. 0.569 4.347 ↑ 254.3 5,666 1

Materialize (cost=2,219,023.09..2,226,227.94 rows=1,440,971 width=1,080) (actual time=3.511..4.347 rows=5,666 loops=1)

70. 2.865 3.778 ↑ 254.3 5,666 1

Sort (cost=2,219,023.09..2,222,625.52 rows=1,440,971 width=1,080) (actual time=3.510..3.778 rows=5,666 loops=1)

  • Sort Key: c_2.cadisissueid
  • Sort Method: quicksort Memory: 635kB
71. 0.913 0.913 ↑ 254.3 5,666 1

CTE Scan on bmkholdings c_2 (cost=0.00..32,584.77 rows=1,440,971 width=1,080) (actual time=0.001..0.913 rows=5,666 loops=1)

  • Filter: ((issueclass)::text <> 'CASH'::text)
72. 0.001 0.560 ↓ 0.0 0 1

Subquery Scan on *SELECT* 4 (cost=0.00..32,675.28 rows=7,241 width=1,344) (actual time=0.560..0.560 rows=0 loops=1)

73. 0.559 0.559 ↓ 0.0 0 1

CTE Scan on bmkholdings c_3 (cost=0.00..32,584.77 rows=7,241 width=1,340) (actual time=0.559..0.559 rows=0 loops=1)

  • Filter: ((issueclass)::text = 'CASH'::text)
  • Rows Removed by Filter: 5,666
74.          

CTE totals

75. 1.062 4.107 ↑ 1.0 1 1

Aggregate (cost=32,287,544.19..32,287,544.20 rows=1 width=24) (actual time=4.107..4.107 rows=1 loops=1)

76. 3.045 3.045 ↑ 197,558.9 5,943 1

CTE Scan on securities securities_1 (cost=0.00..23,481,850.32 rows=1,174,092,516 width=24) (actual time=0.000..3.045 rows=5,943 loops=1)

77. 2.560 45,323.785 ↑ 451,574.1 13 1

GroupAggregate (cost=31,011,197.48..31,348,749.10 rows=5,870,463 width=288) (actual time=45,320.951..45,323.785 rows=13 loops=1)

  • Group Key: securities.level1code, securities.level1name, securities.level2code, securities.level2name, securities.level3code, securities.level3name, securities.level4code, securities.level4name
  • Buffers: shared hit=49,177 read=55,799, temp read=23 written=21
78. 5.792 45,321.225 ↑ 987.8 5,943 1

Sort (cost=31,011,197.48..31,025,873.64 rows=5,870,463 width=296) (actual time=45,320.938..45,321.225 rows=5,943 loops=1)

  • Sort Key: securities.level1code, securities.level1name, securities.level2code, securities.level2name, securities.level3code, securities.level3name, securities.level4code, securities.level4name
  • Sort Method: quicksort Memory: 1,028kB
  • Buffers: shared hit=49,177 read=55,799, temp read=23 written=21
79. 1.605 45,315.433 ↑ 987.8 5,943 1

Hash Join (cost=0.03..27,943,401.92 rows=5,870,463 width=296) (actual time=45,313.356..45,315.433 rows=5,943 loops=1)

  • Hash Cond: (securities.effectivedate = totals.datetot)
  • Buffers: shared hit=49,177 read=55,799, temp read=23 written=21
80. 45,309.716 45,309.716 ↑ 197,558.9 5,943 1

CTE Scan on securities (cost=0.00..23,481,850.32 rows=1,174,092,516 width=280) (actual time=45,309.231..45,309.716 rows=5,943 loops=1)

  • Buffers: shared hit=49,177 read=55,799, temp read=23 written=21
81. 0.003 4.112 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=24) (actual time=4.112..4.112 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
82. 4.109 4.109 ↑ 1.0 1 1

CTE Scan on totals (cost=0.00..0.02 rows=1 width=24) (actual time=4.109..4.109 rows=1 loops=1)

Planning time : 94.663 ms
Execution time : 45,326.052 ms