I have one question regarding “IN CLAUSE.” How does it work internally?
Example: My user table has the following PRIMARY KEY: PRIMARY KEY((tenant_id, user_id))
My Requirement is Get multiple users from the users table using tenant_id and user_id.
-
I can use IN QUERY, e.g.:
select * from user where tenant_id=‘testtenant’ and user_id in (‘64d73074-1bd1-486e-b717-265b1d46c022’,‘64d73074-1bd1-486e-b717-265b1d46c022’); -
I can get individual users by using the partition key. (+Redis caching of frequent users)I want to understand how “in query” works internally. If you have any posts, that would be useful.
What approach is better for fetching such data if:- Users count is below 100
- More than 100
*Originally asked on the User Slack channel.