Rohan Prabhu
Rohan Prabhu

Reputation: 7302

DynamoDB scanning by attribute equality for attributes within an object

I have a table called "Users" in DynamoDB. The columns in the table are:

"UserId", "UID_INTERNAL", "UID_EXTERNAL", "IsActive" ...

For all the users that have the same INTERNAL and EXTERNAL id, they are essentially non-human users i.e. system userIds. I wish to fetch them. What I am doing currently is fetching all the records where IsActive is 1 and then check for equality myself. This was fine till some time ago when the number of users were quite less. Due to corporate user id imports, the number of human users is around 93% of the total users. So essentially, I am fetching more than 93% extra data on the wire for no reason (which has greatly increased our bills because we have had to provision more and more capacity every single time).

Is there a way for me to perform a scan query such that I can have a Condition that checks for attributes within the table before returning that data?

Upvotes: 1

Views: 137

Answers (1)

Chen Harel
Chen Harel

Reputation: 10052

It is not possible to add a condition based on the element itself (INTERNAL EQ EXTERNAL)

I think you are better off with another table that holds only the non-human for easy fetching.

Upvotes: 3

Related Questions