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:
- 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.
- 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
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.
Can someone please help me with this and let me know if this is even possible?
(Working on SQLite 3.7.7.1 and Linux [SLES 11] Box).