<html 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=Windows-1252">
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.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>
</head>
<body lang="EN-US" link="blue" vlink="#954F72">
<div class="WordSection1">
<div>
<pre>> <span style="color:black">Workaround: 'pyodbc' or 'psycopg2'</span><br><br>Hey Marco, I probably should have specified I’m trying to keep all my logic in a plpgsql function so that all work can be done in a single transaction. dblink is basically the same concept as psycopg2 -I can create 7 connections to do the work and then wait for them to complete, but then I’d have to commit the source table so that the connections I spawn would be able to see it and also make sure those connections are cleaned up. <br><br>Postgres parallelism handles all of that -and I’m getting the max number of workers. The issue I appear to be having is that postgres seems to be allocating all of the rows to a single worker because all of the rows are under block size due to toast and the parallelism is blockwise rather than rowwise.<br><br>So I think what I need to do is figure out how to get the rows to be just a bit under the block size so that each worker is reading one row/block. <br><br>To this effect, I tried making a dummy text column and filling with lpad(‘’,2000,’0’) and then setting the storage parameter toast_tuple_target = 8160 (max) for the table assuming that would force reading of one row/block and cancel out the TOASTing of the geometry column -but this sadly did not succeed.<br><br>It is good to know that the psycopg2 type approach holds up on a vast number of cores though.<span style="color:black"><o:p></o:p></span></pre>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">
Mail</a> for Windows 10</p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>