title: Limiting the number of records in a Sqlite DB
body: <p>What I'm trying to implement here is a condition wherein a sqlite database holds only the most recent 1000 records. I have timestamps with each record. 
  One of the inefficient logic which strikes right away is to check the total number of records. If they exceed 1000, then simply delete the ones which fall out of the periphery. </p>
  
  <p>However, I would have to do this check with each INSERT which makes things highly inefficient.</p>
  
  <blockquote>
    <p>What could be a better logic? Can we do something with triggers?</p>
  </blockquote>
  
  <p>Some related questions which follow the same logic I thought of are posted on SO:-</p>
  
  <p><a href="https://stackoverflow.com/questions/3667085/delete-oldest-records-from-database">Delete oldest records from database</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2969723/sql-query-to-delete-records-older-than-two-years">SQL Query to delete records older than two years</a></p>