Skip navigation links

MySQL Forums :: Triggers :: limit number of rows using a trigger


Advanced Search

Re: limit number of rows using a trigger
Posted by: irek kordirko ()
Date: March 14, 2012 11:48AM

Darren White Wrote:
-------------------------------------------------------
> ah ok thanks. Do you have a suggestion of a way
> around that then?

Create a procedure that will insert log records into the table,
hide the table from clients using proper grants- don't allow them to directly insert or update this table,
allow them only to call the procedure when they want to store log records in the table.
Code your requirements inside the procedure (if count > 100 delete old records, and insert a new record etc.).

I'am not sure if counting and deleting records on each insert would be very efficient from performance point of view,
in multiuser environment this could lead to contention and scalability issues,
maybe the better option would be to create and event that would be scheduled once per day (or better - at night) and clear unwanted records from the table.

Options: ReplyQuote


Subject Views Written By Posted
limit number of rows using a trigger 2746 Darren White 03/13/2012 03:50AM
Re: limit number of rows using a trigger 1024 Darren White 03/13/2012 03:59AM
Re: limit number of rows using a trigger 813 Darren White 03/13/2012 04:09AM
Re: limit number of rows using a trigger 1125 Darren White 03/13/2012 04:11AM
Re: limit number of rows using a trigger 1018 irek kordirko 03/13/2012 11:50AM
Re: limit number of rows using a trigger 719 Darren White 03/14/2012 05:32AM
Re: limit number of rows using a trigger 1223 irek kordirko 03/14/2012 11:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.