all-things-risingwave
Is there an efficient way to handle list/set-membership operations in a materialized view?
I am considering two different query patterns for a materialized view: 1. Get all ids for a given key (infrequent) 2. Check whether an id belongs to a key (very frequent). Is there an efficient way to handle list/set-membership operations in a materialized view?
Ni
Nizar Hejazi
Asked on May 14, 2023
To optimize for the frequent use case of checking whether a (key, id) pair exists, I recommend organizing the materialized view in a way that supports efficient point queries. You can use a point get query (SELECT … FROM mv WHERE id=… and key=…) for the membership check. This approach is efficient because storage can leverage bloom filters for data pruning.
May 14, 2023Edited by