<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 12 (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:"Century Gothic";
        panose-1:2 11 5 2 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi all,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m encountering an incredibly slow run time when I attempt to create a new table (CREATE TABLE AS) with fields populated by calculations which reference two other tables.  Does referencing multiple tables in a calculation like this usually result in a slower run time?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here is a portion of my script:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>CREATE TABLE public.sac_parcel_emp_unemp_calc_062311 AS<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                SELECT<o:p></o:p></p><p class=MsoNormal>                a.id_parcel, a.vc_pop, a.pop_age16_up,<o:p></o:p></p><p class=MsoNormal>                <o:p></o:p></p><p class=MsoNormal>                CASE<o:p></o:p></p><p class=MsoNormal>                WHEN b.p043001 > 0<o:p></o:p></p><p class=MsoNormal>                THEN (a.pop_age16_up * (cast(b.p043004 as float) + b.p043006 + b.p043011 + b.p043013) / b.p043001)<o:p></o:p></p><p class=MsoNormal>                ELSE 0                                                                                    <o:p></o:p></p><p class=MsoNormal>                END as pop_employed<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>FROM public.sac_parcel_age16_up as a, public.sac_parcel_block_bg_test_062011 as b;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I also cast one of the variables in the calculation as a float so that the output field would be the same and not populated with zeros. <o:p></o:p></p><p class=MsoNormal>Thanks for any help.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Century Gothic","sans-serif";color:gray'>Conor Henley<o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Century Gothic","sans-serif";color:gray'>GIS/Regional Planning Intern<o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:7.5pt;font-family:"Century Gothic","sans-serif";color:gray'><o:p> </o:p></span></b></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Century Gothic","sans-serif";color:#CC6600'>C A L T H O R P E</span></b><b><span style='font-size:10.0pt;font-family:"Century Gothic","sans-serif";color:gray'>  A S S O C I A T E S</span></b><b><span style='font-size:7.5pt;font-family:"Century Gothic","sans-serif";color:gray'><o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Century Gothic","sans-serif";color:gray'>2095 ROSE STREET, SUITE 201, BERKELEY, CALIFORNIA, 94709 USA<br>510-548-6800 | 510 548-6848 (fax)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Century Gothic","sans-serif";color:gray'><a href="mailto:sheara@calthorpe.com"><span style='color:blue'>conor@calthorpe.com</span></a> | <a href="www.calthorpe.com"><span style='color:blue'>www.calthorpe.com</span></a><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>