I have an entity (Request) which is partitioned by userId. For each userId, I will have an index, right?
However, I would like to quickly search the request by userId. Is there a simple way to do that? Or I will need to choose another field to create the partition?
You can partition TWO ways if you like. Let’s say you do this
You can have private String userId instead of User if you like ;).
Now, you can query into a time partition using the beginning of the month as a key and just do a query OR you can query into a user partition using user as the key.
Your named query IF you partition by two things would be…
If you only partition your table by users, you can write
NOTE: The only reason you sometimes need to index the primary key like I have is for a range query on the primary key….for an equals query where pk= some value, you don’t need an index obviously since you can look up by the primary key itself.
Dean