Using a simple Person.first seems to load all people in the database and then only use the first record.
Output from redis monitor when doing a Person.first with 3 records in the db:
+1311105369.469164 "smembers" "person🆔all"
+1311105369.469654 "hgetall" "person:1"
+1311105369.470109 "hgetall" "person:2"
+1311105369.470555 "hgetall" "person:3"
There are many non-indexed uses of dm-redis that will incur a performance penalty based on the number of records, since the way that the adapter is currently written will fall-through to finding each record in the set of all records when a query has no other more optimal path to locating that record.
In the case of #first, I agree, there should be a more optimal path that the adapter uses to locate the first record, since loading each record is wasteful.
I'm not sure I'll have a chance to work on this in the near future, did you have a suggestion for improving the performance of #first?
In my app, Houses can have many Rooms. When i do house.rooms, I can see in redis-cli monitor that it fetches all (thousands) of rooms, even though only a few correct rooms are returned in the code. Of course this is very slow.
In House I have:
property :id, Serial, :index => true
Am I doing something wrong? Surely fetching all rows every time I just need the associated objects can't be right?