Say I have a table
prices. Users can see the prices of this table (I'm simplifying it). Users also can send prices to the server, so the server is going to collect these data in another table (
When the server detects that there are 50 prices or more, then the server calculates a median of those temporal prices and update the table
prices with the calculated value (again, very simplified).
The first idea that came to my mind was have two tables with the same schema but different names (
I don't know if this is a good/common practice. I am missing something?
Also, what mechanism should I use to trigger the server to inspect the table
temp_prices? I think about
cron but again, I don't know if there is something I'm missing (another tool or common practice for doing this kind of stuff).