title: Move old records from a mysql table when new ones come in
body: <p>Heads up, I can only build this using SQL.</p>
  
  <p>I have a table called Stream. When I get new datas (batch insert) from an external source, they're temporarily stored in stream (engine=memory). Each row in the Stream table has a timestamp. I need to move any data that's old than 30 minutes to a History table(engine=myISAM) as new inserts happen. What would be the best way to approach it? I kinda want to use triggers but don't know if that's an optimal solution. I thought about having a trigger that could delete old data from the table on insert. However, since the new data comes in a batch with the same timestamp, I didn't want to loop through the entire table for each individual insert. I'd rather have it do the delete once the batch insert completes. If I were using a programming language like python to insert, update, I could use it to keep track of application state. But since I can't use anything else besides SQL, I've kinda hit a wall.</p>