title: I need to filter a large database 2 billion entries using python and sql
body: <p>The data is in bytea format, how do I query the postgresql database, its is indexed in the bytea column i need to query by the first 4 bytes. I have tried </p>
  
  <pre><code>SELECT * FROM table WHERE addr LIKE '%8ac5c320____' 
  </code></pre>
  
  <p>but it takes too long to find. Any suggestions? if I query the whole string then it works fast, but there are about 2 billion entries and i cant use wild cards...</p>