Fix the slow running queries for collections (bug 1090963)

Fixes [bug 1090963](https://bugzilla.mozilla.org/show_bug.cgi?id=1090963)