title: Select truncated string from Postgres
body: <p>I have some large <code>varchar</code> values in Postgres that I want to SELECT and move somewhere else. The place they are going to uses <code>VARCHAR(4095)</code> so I only need at most 4095 bytes (I think that's bytes) and some of these varchars are quite big, so a performance optimization would be to SELECT a truncated version of them.</p>
  
  <p>How can I do that?<br>
  Something like:</p>
  
  <pre><code>SELECT TRUNCATED(my_val, 4095) ...
  </code></pre>
  
  <p>I don't think it's a character length though, it needs to be a byte length?</p>