brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
8 stars 21 forks source link

Improve performance of `random` #47

Closed aleksandra-kim closed 6 years ago

aleksandra-kim commented 7 years ago

Original report by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Using order by ? takes a while, as SQLite has to order all rows, especially at startup. Better to leave ordering undefined, but still leave a iteration randomly ordered. So just need to change .random(), but check this!

See also: http://stackoverflow.com/questions/4114940/select-random-rows-in-sqlite

aleksandra-kim commented 6 years ago

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Fix #47. Improve performance of 'random' by faking it