mirage/orm

Ordering in query

pdonadeo opened this issue · 3 comments

It would be nice to have an ordering option in queries, something like (following the image example in the documentation):

let my_pics db = gallery_get ~order_by:(`date) db

This is important because in-memory sorting after a "SELECT *" is possibly inefficient and even impossible in many cases (large datasets).

I've pushed some preliminary work on my tree around these line; the problem is that currently all the rows are loaded in memory and then later converted into ML values (and at this point, as we are using an accumulator, the list is reverted). So I am not sure we gain much by ordering the row at first ... anyway, the changes are in my tree.

I think the memory problem is fixed by my fix to issue 4.

Thanks, I'll try the two patches (this one and the lazy getters) next week end.