[Design Discussion] Indexed User Attributes #851
ThumulaPerera
started this conversation in
Design
Replies: 1 comment
-
Why we need to define it as a new attribute in the user schema? I remember we already have an unique attribute can't we reuse it? This way, we can detect the duplicate entry during user creation easily using this indexing and I assume User Identification during uses the unique attributes. Do you see any concerns here ?
I assume the unique attribute is allowed for the strings and numbers. But in the store level, we can keep values as varchar in the USER_INDEXED_ATTRIBUTES table |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Related Feature Issue
#511
Problem Summary
Currently, all user attributes are stored as JSON in the
ATTRIBUTEScolumn. Identifying a user requires:This will lead to performance issues down the line when handling large number of users.
Proposed Approach
Implement global attribute indexing for a subset of user attributes, which are frequently used for user identification.
USER_INDEXED_ATTRIBUTESwith 3 columnsUSER_ID,ATTRIBUTE_NAMEandATTRIBUTE_VALUEto store indexed attributes.USERandUSER_INDEXED_ATTRIBUTESatomically during user create, update, delete operations.USER_INDEXED_ATTRIBUTEStable (using JOINs when multiple identifier attributes are there).USERandUSER_INDEXED_ATTRIBUTEStable using JOINsUSERtable.Technical Questions for Discussion
I have done a quick PoC and a local perf test and obtained following numbers for authentication (without getting an assertion). Given these numbers we need to decide whether this approach is worth pursuing.
Single-Attribute Search
Two-Attribute Search
There are 2 possible ways to define the global list of indexed attributes. We need to decide which approach to follow.
a) Make the list a server configuration (read from
config.yaml)Pros
Cons
b) Define the indexed attributes during user schema creation
Pros
Cons
A schema can only define an attribute as indexed only if it's already an indexed attribute (defined previously by another schema) or if it's a new attribute which is not defined by any existing schemaShould we support indexing for attributes which are of a different type than string?*
Alternative Approaches
We initially considered defining indexed attributes independently for each user-schema. However, in order to benefit from indexes with that approach, we need to know the user type during authentication. Without knowing the user type, we cannot guarantee that
USER_INDEXED_ATTRIBUTEStable will return all matches and hence need to do a sequential search inUSERtable anyway.Architecture and Components
User Store:
Security Considerations
user-type-aanduser-type-b) have the same attribute name. But the selectivity of the attribute is very high inuser-type-aand very low inuser-type-b. Indexing that attribute to improve performance foruser-type-acan degrade performance foruser-type-b.Implementation Complexity
Low (1-2 weeks)
Areas of Thunder that will be impacted
Questions for Community Input
No response
Beta Was this translation helpful? Give feedback.
All reactions