Mnesia Order By

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Thu Apr 21 14:16:07 CEST 2005

Wouldn't your select() call return the 100 records to display on the page?
If so, sorting the results of the select() call is the way to go.

-----Original Message-----
From: Casper [mailto:casper2000a@REDACTED]
Sent: den 21 april 2005 13:56
To: 'Vladimir Sekissov'; Ulf Wiger (AL/EAB); erlang-questions@REDACTED
Subject: RE: Mnesia Order By



Thanks for the info.


For that, do I have to read all the records before do a sorting? For example, what if I have to navigate through a record set with about couple of hundred thousands of records, 100 records in each page?


I.e. I jus want to navigate through a huge database on a Web Page, which gives 100 records in each page. Data is sorted by the Key ID or Entered Date. Viewer can navigate through the records by going to Previous and Next Pages.


What I don't want is to do a sorting of 100,000 (let's say) records in each page to get the 100 records to be displayed.


What's the best method I can use?



- Eranga






From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB)
Sent: Thursday, April 21, 2005 5:15 PM
To: erlang-questions@REDACTED
Subject: RE: Mnesia Order By



The current solution is: sort the list produced by the select() call.


Using qlc, you can produce a handle that, when evaluated, returns a sorted result.

See the reference manual on qlc (in stdlib.)



-----Original Message-----
From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Casper
Sent: den 21 april 2005 12:15
To: erlang-questions@REDACTED
Subject: Mnesia Order By

Hi All,


How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL)


Please advice as soon as possible.



- Eranga

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list