Mnesia Order By

Sean Hinde <>
Thu Apr 21 14:50:53 CEST 2005


Hi,

On 21 Apr 2005, at 12:55, Casper wrote:

>
> Vladmir/Uffe,
>  
> 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.


I have made a similar system in the past. The approach I used was to 
keep an additional ordered set table for each of the extra items to 
sort by. This just pointed into the primary key of the main table.

Then to get the first 100 records by, say, date I would select from the 
date index table and read each record from the main table.

Sean




More information about the erlang-questions mailing list