Set transaction isolation level to repeatable read

Switch to transaction isolation level to repeatable read to
allow running against a slave database.
Put checks in to verify that rows from postgres are sorted by ID.
We don't really need tags sorted by key, and it might make more efficient use of the index.
Merge remote-tracking branch 'zere/master'