[erlang-questions] How to select a record with an attribute which is maximal in mnesia table?
Wed Apr 14 16:15:40 CEST 2010
Just keep in mind mnesia doesn't support disk copies of ordered sets so
you'll have to serialize to disk manually, either on every update,
periodically or on app exit (tricky in cases where your app core dumps).
Alternatively, you can simply write to a flat file on the side of your
mnesia table in memory (or just go with the flat file) and then on app
start, open the file, seek to the end - size of your record (hopefully fixed
size...) and voila.
On Wed, Apr 14, 2010 at 9:22 AM, Bengt Kleberg
> Would it be ok for you to have the date/time as record key? If you have
> that and an ordered_set then the last record is just that, last.
> On Wed, 2010-04-14 at 11:34 +0200, 钱晓明 wrote:
> > Hi, I want to select a record with an attribute which is maximal from
> > table, so should I use qlc?
> > For example, I have to insert a record into a table every 5 minutes, and
> > when my program start up, it should read the last record to get some
> > information.
> > So how can I achieve this?
> > Thanks!
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
More information about the erlang-questions