Mnesia Order By

Ulf Wiger (AL/EAB) <>
Thu Apr 21 16:24:42 CEST 2005


 
Sounds to me as if you need compound indexes. ;-)
 
See http://www.erlang.org/ml-archive/erlang-questions/200502/msg00233.html
 
I'm currently re-hacking my code in order to turn the indexes into first-class
tables. Not quite done, though.
 
(When I get something working, who wants to take it for a spin?)
 
/Uffe
 

-----Original Message-----
From: Casper [mailto:]
Sent: den 21 april 2005 14:46
To: Ulf Wiger (AL/EAB); 
Subject: RE: Mnesia Order By



Uffe,

 

 

Even though the select call returns only 100 records, I want those records to be globally sorted. What I mean is not those records sorted within those 100, but it's the next block of sorted whole table.

 

I don't know if above is clear...

 

Thanks,

- Eranga

 

 

 


  _____  


From:  [mailto:] On Behalf Of Ulf Wiger (AL/EAB)
Sent: Thursday, April 21, 2005 6:16 PM
To: 
Subject: RE: Mnesia Order By

 

 

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.

 

/Uffe

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

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.

 

What's the best method I can use?

 

Thanks!

- Eranga

 

 

 

 


  _____  


From:  [mailto:] On Behalf Of Ulf Wiger (AL/EAB)
Sent: Thursday, April 21, 2005 5:15 PM
To: 
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.)

 

/Uffe

-----Original Message-----
From:  [mailto:]On Behalf Of Casper
Sent: den 21 april 2005 12:15
To: 
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.

 

Thanks!

- Eranga

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050421/232ea10b/attachment.html>


More information about the erlang-questions mailing list