title: Making the postgreSQL/SQL Alchemy orm select faster
body: <p>I have a table with a large number of rows ( ~ 1 million ) and when I use the following select query It takes avg of .002 seconds to get the result, I have to loop through this records, so I need this to be faster, I am using an SQLAlchemy ORM to execute queries</p>
  <pre><code> MaxSeq = 10 #MaxSeq  can change 
   config.session.query(OTableConsignList.A).filter(
                      OTableConsignList.B== 'SOMEID',
                      OTableConsignList.A!= 'SOMETHING' ,
                      OTableConsignList.A!=  'SOMETHING_ELSE', or_(OTableConsignList.C&lt; MaxSeq ,
                                                                 MaxSeq == 0))
  
  </code></pre>
  <p>I have created an index as follows</p>
  <pre><code>
  CREATE INDEX consign_list_index ON tbl_consign_list(&quot;A&quot;,&quot;B&quot;,&quot;C&quot;)
  </code></pre>
  <p>Now any other suggestions to improve the speed?</p>