jdlev has asked for the wisdom of the Perl Monks concerning the following question:
The hard part is I want to now upgrade this mysql database so that it monitors the *changes* in price from one time period to the next.
So here is the basic idear:
1) Program inputs epoch, timestamp, last price, and now, price change into mysql database.
2) 5 minutes goes by, this program goes out on the web and collects the same data. Only this time, it looks at the previous record to get the price that was entered 5 minutes before.
3) It runs a price change percentage equation (p2 - p1)/p1, and inserts that along with the latest price into my table.
4) Repeat
I am inserting about 9 new record sets everytime this routine runs, so I would like to keep it as short and sweet as possible. I know I could run a select statement and query the database to get "lastinsert id", but I'm not sure if that is the fastest way to do it. Thanks for any advice!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (OT) Dearest Monks - Mysql Question - Compare current insert record with last record inserted.
by moritz (Cardinal) on Nov 19, 2009 at 15:25 UTC | |
by jdlev (Scribe) on Nov 19, 2009 at 18:29 UTC | |
by keszler (Priest) on Nov 19, 2009 at 20:15 UTC | |
by jdlev (Scribe) on Nov 19, 2009 at 21:13 UTC | |
by keszler (Priest) on Nov 20, 2009 at 02:33 UTC | |
|
Re: (OT) Dearest Monks - Mysql Question - Compare current insert record with last record inserted.
by keszler (Priest) on Nov 19, 2009 at 15:19 UTC |