On Wed, Aug 28, 2002 at 05:33:57PM -0500, Naushit Sakarvadia wrote:
> Is it possible to limit size of table?
>
> For example I want xyz table to limit 1 GB and once it reaches
> 1 GB it should start overwriting oldest data.
>
> Is it possible to do this in Mysql? or is there any client that can
> monitor table and truncate it?
> I am basically logging some high volume log to mysql and I am not interested
> in very old data but i want to limit the diskspace.
>
> I am not subscribed to mailing list so please reply to
> [EMAIL PROTECTED]
>
> Thanks in advance
> Naushit Sakarvadia.
I already resolved the very same problem in a particular way that I
dont know if will satisfy you.
Ive created a 'round robin' table with pre-created rows with a row_id
INT column, sequencial, 0-NUMBER_OF_ROWS-1
All you have to do is: mantain a 'last_row' somewhere else and
substitute your INSERT with:
new_row_id = (last_row + 1) % NUMBER_OF_ROWS
cursor.execute("BEGIN") # Im assuming InnoDB here
cursor.execute("UPDATE (...) WHERE row_id = new_row_id")
cursor.execute("UPDATE FOOBARTABLE SET last_row = new_row_id")
cursor.execute("COMMIT") # Im assuming InnoDB here
Sergio Bruder
--
http://pontobr.org
pub 1024D/0C7D9F49 2000-05-26 Sergio Devojno Bruder <[EMAIL PROTECTED]>
Key fingerprint = 983F DBDF FB53 FE55 87DF 71CA 6B01 5E44 0C7D 9F49
sub 1024g/138DF93D 2000-05-26
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php