Hello, I am worried about the costs associated wit...
# community-help
m
Hello, I am worried about the costs associated with Typesense. Regarding pagination, is retrieval of the subsequent pages in a search considered separate requests, or are they retrieved from a cache created by the initial search?
k
Hello, I am worried about the costs associated with Typesense.
Can you elaborate?
We don't cache result set from previous pages.
m
I'd like to use Typesense for full-text search and expensive quering. I have an app with an infinite scrolling list and would like to request the next batch of 10 results as a user scrolls down. Making an expensive query every time seems very expensive and wasteful so I'd like to make subsequent calls to cache instead.
k
I agree that this can be optimized, but caching will introduce some complexities around cache busting due to writes etc. For now, you can fetch 250 results upfront and then do in-app pagination.
When you do a search, Typesense anyway operates on a minimum working set of 256 hits, so this won't be slower (except for fetching 256 records at once, which should be fine unless docs are huge)
m
Oh okay, so to retrieve the next page, Should I make a request every time the user scrolls down 256 documents?
k
Yes but note that deep pagination does impact performance.
m
yes, that is also my concern. If i set the use_cache flag to true, would that fetch subsequent pages on the same query from cache, or do I have to over-fetch let's say 1000 records and implement my own caching solution?
k
Use cache only caches whole results, not per page result set
m
I understand. Thank you. I think this might be okay for full-text search but when running an expensive query that's not fully indexable this might be expensive without caching.