Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not sure I entirely understand the question, but we ultimately end up hooking into libpq, and right now the queries are synchronous. As we look towards features like associations, this will actually have to be true to some extent, since if we want the return type to be `(User, Vec<Post>)`, we actually need to allocate the entire result set we're reading into memory to implement `next()`.


Would it be desirable or possible to instead return a lazy collection that only fetches perhaps 10 results and fetches more as you iterate?


It's impossible. We can't guarantee the order of the result set, so we'd have to iterate the entire collection just to implement `next`




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: