1

My table contains around 16 columns. I want to limit number of rows at 10000. I can :

  1. Insert only if current size less than 10000.
  2. Put a configuration limit (either through some external configuration file or through some dynamic parameter) on the maximum number of rows.

I prefer option 2 because reduced effort checking size for every insert (my table is insert intensive, reading is occasional). It would be useful if this limit can be dynamically set (for example using an sqlite3_limit() -like API), but an /etc/* -like configuration file too would do.

Is this possible on SQLite 3.7.7.1 and Linux (SLES 11)?

user4157124
  • 2,809
  • 13
  • 27
  • 42
Shrey
  • 679
  • 2
  • 6
  • 15
  • possible duplicate of [Limit a sqlite Table's Maximum Number of Rows](http://stackoverflow.com/questions/2035670/limit-a-sqlite-tables-maximum-number-of-rows) – luvieere Aug 29 '11 at 07:47
  • A third option: http://www.sqlite.org/lang_createtrigger.html – Tim Aug 29 '11 at 10:15
  • @luvieere, this is very similar to the question in the link you posted. Only difference being, I am looking for a configuration parameter. In the question poster in the link you provided, the aim is to get a SQL query based mechanism. And it now seems that no such configurable parameters exists. – Shrey Aug 31 '11 at 14:30
  • Thanks @Tim. Unfortunately, I am using the C interface wherein the action to be taken when the number of rows are deleted is driven by a independent module (for example, restricting insertions or deletion). In case of trigger, I would have to use a pre-defined method (like deleting) while creating the DB. Thanks for your comment anyways. – Shrey Aug 31 '11 at 14:32

0 Answers0