Hi All,
So I'm trying to do this...
UPDATE all_emis_gp_clinical a
FROM tmp_all_emis_gp_clinical s
SET duplicate = s.proton
WHERE a.pid = s.pid
AND ifnull(a.event_dt, '1-jan-1885') = ifnull(s.event_dt, '1-jan-1885')
AND a.code_type = s.code_type
AND ifnull(a.code, '[:null:]') = ifnull(s.code, '[:null:]')
AND ifnull(a.value, -999999.9) = ifnull(s.value, -999999.9)
AND ifnull(a.unit, '[:null:]') = ifnull(s.unit, '[:null:]')
AND a.atom != s.proton
AND a.status IN (0, -1) AND a.redact = 0
Trouble is that all_emis_gp_clinical has 374million rows and is partitioned 16 ways to support that. The tmp_all_emis_gp_clinical has 280million rows. It's not partitioned, but it needs 5+million pages to hold the data.
How long will that take.?
The answer was...I gave up after 15 hours. I added a AND MOD(s.pid, 10) = 0 and restarted....3+ hours later it's still going.
I transferred the tables to a database with x100 enabled and tried there.
The full update.... (94114201 rows in 213.871276 secs)
And followed that with a memory cleanup...
modify all_emis_gp_clinical to combine;
(374110276 rows in 194.169678 secs)
So just over 400 seconds to do the lot!
I've seen selects work brilliantly, but I was astounded that an update would work so well.
Martin Bowes
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="
http://schemas.microsoft.com/office/2004/12/omml" xmlns="
http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)"> <style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Lucida Console";
panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So I’m trying to do this…<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">UPDATE all_emis_gp_clinical a<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">FROM tmp_all_emis_gp_clinical s<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">SET duplicate = s.proton<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">WHERE a.pid = s.pid<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND ifnull(a.event_dt, '1-jan-1885') = ifnull(s.event_dt, '1-jan-1885')<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND a.code_type = s.code_type<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND ifnull(a.code, '[:null:]') = ifnull(s.code, '[:null:]')<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND ifnull(a.value, -999999.9) = ifnull(s.value, -999999.9)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND ifnull(a.unit, '[:null:]') = ifnull(s.unit, '[:null:]')<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND a.atom != s.proton<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""> AND a.status IN (0, -1) AND a.redact = 0<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Trouble is that all_emis_gp_clinical has 374million rows and is partitioned 16 ways to support that. The tmp_all_emis_gp_clinical has 280million rows. It’s not partitioned, but it needs 5+million pages to hold the data.<o:p>
</o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">How long will that take.?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The answer was…I gave up after 15 hours. I added a AND MOD(s.pid, 10) = 0 and restarted….3+ hours later it’s still going.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I transferred the tables to a database with x100 enabled and tried there.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none">The full update….<span style="font-size:10.0pt;font-family:"Lucida Console""> (94114201 rows in
<span style="background:yellow;mso-highlight:yellow">213.871276 secs</span>)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">And followed that with a memory cleanup…<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">modify all_emis_gp_clinical to combine;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Lucida Console"">(374110276 rows in
<span style="background:yellow;mso-highlight:yellow">194.169678 secs</span>)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So just over 400 seconds to do the lot!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve seen selects work brilliantly, but I was astounded that an update would work so well.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Martin Bowes<o:p></o:p></p>
</div>
</body>
</html>
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)