title: Limiting the number of rows in an SQLite Table
body: <p>I am creating a database containing a single table which contains around 16 columns. The upper limit to the number of rows has been set at 10000 rows - decided after analyzing the amount of space it consumes. There are two possible strategies I can follow for forcing this limit:</p>
  
  <ol>
  <li>Before inserting any row into the table, I check the size of the table and then insert only if the current size if less than 10000.</li>
  <li>Putting a configuration limit (either through some external configuration file or through some dynamic parameter) on the maximum number of rows that can be added for a single table</li>
  </ol>
  
  <p>Of the above, I prefer the option 2 primarily because that reduces the effort of checking the size for every insert (and my table is insert intensive, reading is occasional). I have been searching for a way to set the upper limit on the number of rows but couldn't come up with a plausible solution. It would certainly be most useful if this limit can be dynamically set (for example using the sqlite3_limit() like API), but, an /etc/* like configuration file too would serve the purpose.</p>
  
  <p>Can someone please help me with this and let me know if this is even possible?</p>
  
  <p>(Working on SQLite 3.7.7.1 and Linux [SLES 11] Box).</p>