Efficiently store last X items in an MySQL Database

Posted by Saif Bechan on Stack Overflow See other posts from Stack Overflow or by Saif Bechan
Published on 2010-04-06T08:49:58Z Indexed on 2010/04/06 8:53 UTC
Read the original article Hit count: 170

Filed under:
|
|

I want to store the last 3 items in an MySQL database in an efficient way. So when the 4th item is stored the first should be deleted.

The way I do this not is first run a query getting the items. Than check what I should do then insert/delete.

There has to be a better way to do this. Any suggestions?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about efficiency