title: How to make bytea selection faster
body: <p>Currently my following query requires <code>5-6 seconds</code> to execute. This table has around <code>2.4 million</code> records. Each row having 7 <code>bytea</code> columns and summation of 7 columns are <code>80 KB</code> in size.</p>
  
  <pre><code>select * from test_table where id &gt; 1 and id &lt; 300;
  </code></pre>
  
  <p>Below is the postgresql configuration:</p>
  
  <pre><code>psql version: 9.3.1
  shared_buffers = 3072MB
  temp_buffers = 128MB
  work_mem = 128MB
  maintenance_work_mem = 256MB
  </code></pre>
  
  <p>Machine info:</p>
  
  <pre><code>CPU: 2.30GHz
  Core: 2
  RAM : 10 GB
  </code></pre>
  
  <p><code>EXPLAIN ANALYZE</code> on the sql returns:</p>
  
  <pre><code>"Index Scan using test_table_pkey on test_table  (cost=0.43..24.47 rows=302 width=239) (actual time=0.037..0.847 rows=298 loops=1)"
  "  Index Cond: ((id &gt; 1) AND (id &lt; 300))"
  "Total runtime: 1.438 ms"
  </code></pre>
  
  <p>Is it a normal behavior? Or is there something that I can modify to make the query a little bit faster?</p>