#Confirmation regarding filtering on paginated queries

1 messages · Page 1 of 1 (latest)

orchid hill
#

Just wanted to confirm how filtering works in a very specific scenario.
When 1. not using an index and 2. using a paginated query, will applying a filter on this query perform a full table scan or just on the current page?

#

In other words, will the following .filter perform a full table scan or scan through the initialNumItems setting in the paginationOpts

          users = await db
            .query("users")
            .filter((q) => q.neq(q.field("name"), "Alex"))
            .order("desc")
            .paginate(paginationOpts);
jagged plank
#

It will scan the table until it finds initialNumItems that satisfy the filter. If most people have name!=Alex, it will read approximately initialNumItems. If most people are named Alex, it may scan the entire table. (edited because i missed the q.neq)