Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I query to get 100,000 records as quickly as possible? #804

Open
namdv-1375 opened this issue Sep 11, 2024 · 1 comment
Open

How can I query to get 100,000 records as quickly as possible? #804

namdv-1375 opened this issue Sep 11, 2024 · 1 comment

Comments

@namdv-1375
Copy link

If I use batchGetItem it asks for the key. However, I cannot know this key in advance, for example the key is the id of the table. So how should I handle this problem?
Pls help me, Thank you!
cc @andrykonchin <3

@andrykonchin
Copy link
Member

Could you please provide more context?

DynamoDB provides two kinds of read operations:

  • when primary key is known (GetItem and BatchGetItem)
  • when it is unknown (Scan and Query)

So if you don't know primary key values in advance (but have some conditions on attributes), then the only option is Scan and Query. They are used by a method where (similar to Rails' ActiveRecord):

u = User.find(1)
addressed = u.addresses.where(city: 'Chicago').all

You can find more examples with where in the Readme and RDoc documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants