ErlyORM / boss_db

BossDB: a sharded, caching, pooling, evented ORM for Erlang
Other
277 stars 138 forks source link

Default sort on ID a bad idea if ID is a UUID #174

Open davidw opened 10 years ago

davidw commented 10 years ago

Given

boss_db:find(fixation_target, []). 

The query generated is:

12:06:46.827 [info] QUERY: SELECT * FROM fixation_targets WHERE  TRUE ORDER BY id ASC PARAMS []

Which seems like a bad idea as it is wasting time sorting UUID id's.

davidw commented 10 years ago

Here's a hacky way to get around that on Postgres:

boss_db:find(fixation_target, [], [{order_by, 'true'}])