simon-brooke / youyesyet

Web-app to support canvassers in the forthcoming independence referendum in Scotland
GNU General Public License v2.0
3 stars 0 forks source link

Paging result sets #42

Closed simon-brooke closed 6 years ago

simon-brooke commented 7 years ago

This database is going to be large. We will have of the order of one million addresses, four million electors, potentially four million visits. Selecting all data from the database for user interface lists isn't going to work - it will be too slow and things will break.

I haven't seen a good account of how to do paging in any of the high level frameworks such as Korma or HugSql (which is startling).

We need something which plays nice with (ideally) HugSql and definitely plays nice with Postgres. We probably ought to do it as a separate library, or possibly as a HugSql pull request, because actually lots of projects are going to need this.

simon-brooke commented 6 years ago

This should be solved by the queries I'm now generating in squirrel-parse, which use the limit-offset solution. It isn't perfect but doesn't have huge overheads and will probably do for now.