title: PostgreSQL connecting and disconnecting on each query
body: <p>How should I use postgresql? Should I just connect to db once when the app is starting and stay connected or connect/disconnect on each query?</p>
  
  <p>The problem I have when I stay connected is that after some time it will always throw me this error: <code>"Error: read ECONNRESET"</code> .</p>
  
  <p>Basicly I do this:</p>
  
  <pre><code>db.connect(); //in there I create pg.client and connect to db
  </code></pre>
  
  <p>and than I just do normal <code>db.client.query()</code>, but that after some time throws the error, so should I on each query do <code>connect()</code> and after it <code>disconnect()</code> - <code>client.end()</code>?</p>