It's faster this way - we get the set of IDs with a very simple retrieval and then retrieve the selected subset directly.  The alternative is to construct a very complex where clause that SQLite takes forever to process. A third alternative would be to come up with a smarter filter implementation that recognized the pattern and constructed a temporary table, but that's an exercise for the future.