Hi guys! I have a performance question that maybe ...
# community-help
j
Hi guys! I have a performance question that maybe you can give me hint on. I have this category hierarchy (in memory, not in typsense) which might consist of a maximum of 1k categories. Depth wise maybe max 10. In my typsense collection of products, every document holds a single
category_id
value. What I want to do is to search for products that belong to a specific category_id AND all of its subcategories. I can easily traverse the category tree and identify all category_ids that I need to filter for. My question is, how bad is it, performance wise, to potentially filter on hundreds of values?
k
The most performant way to address this is to have 10 fields, e.g.
category.level0
,
category.level1
etc. so that when you want to filter you can do that at any level in the category hierarchy with a single filter by field.
j
That would be a nice solution. The only problem I see with that is when there are updates to the category tree, a lot of documents might need to be updated (there will be millions of products in the collection)
k
But those tend to be rare as well right? Updating those fields should be pretty fast. Can probably ingest millions in < 60s.
(we support partial document updates)
I recommend optimizing for search because those tend to be many many times more frequent than category updates.
👍 1
j
Correct. Thank you for your quick response!