That is one approach you could take and it would get the job done, but it has a few drawbacks/side effects:
- You would also replicate all videos in that GSI, which increases the storage and throughput cost of it
- You would create a potentially huge item collection that contains all users, which could lead to a hot partition and may not scale well.
Instead, consider splitting up the huge user partition in the GSI into multiple ones with predictable keys.
If you plan to list your users by username later, you could take the first letter of their username as the partition key and thereby create around 26 (depending on capitalization and character set) different partitions, which would spread out the load a lot better. To list all users, you'd have to issue queries on all the partitions, which is annoying at small sizes, but will be more scalable.
Another option would be to define that you want to spread the users out among n
partitions and then use something like hash(user_id) mod n
to get a partition key for the GSI. That way you'd have to do n
queries to get the values of all partitions.