Günter Greschenz <[EMAIL PROTECTED]> wrote:
i always thought there is always an index for "rowid" ?

There is, but an index cannot be used for a complex condition like rowid%100000=x. An index can only be used for comparisons like rowid=x, rowid>x, rowid in (x, y, z).

Imagine that you are asked to retrieve every 100000's name from a phone directory. Would the fact that the book is alphabetically sorted help you any?

i need to store a maximum amount of data in the database (e.b. max
100000 entries or max 10 days)
any idea how i could implement it in another way ?

Rotate the data between two tables. Insert into msgs table until you get 100000 records in it (keep track of the number of records in a separate table: "select count(*) from msgs" runs in linear time, too). Once the table is full, rename it to msgs_archive or something (use ALTER TABLE statement; drop any existing msgs_archive table first, of course), recreate msgs table and start filling it. Lather, rinse, repeat. You should be able to do all this with triggers.

That means that sometimes you would have up to twice as much data as you strictly need, but you never have less than what you need.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to