title: Postgresql Linked Server Query very Slow
body: <p>i have this problem:</p>
  
  <p>Making queries over linked server to postgresql is very slow, very, very slow, for example:</p>
  
  <p>if i run in pgAdmin this query:</p>
  
  <pre><code>select max(oldmedicionid) from tl.tlinputtable
  </code></pre>
  
  <p>it returns the max result in just: 246 msec</p>
  
  <p>But if i run that over linked server (using sqlserver 2008), i create the dblink using an odbc to postgresql, so if i run this:</p>
  
  <pre><code>select MAX(oldmedicionid) from LINKPDATL.PDATL.tl.tlinputtable
  </code></pre>
  
  <p>the query give me result in 1 minute or more sometimes...</p>
  
  <p>What could be my problema?, i think is not with my postgresql database, is something like the dblink is very slow, </p>
  
  <p>How can i improve the performance?</p>