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

User-defined secondary indexes #129

Open
tkadlec opened this issue Aug 29, 2024 · 1 comment
Open

User-defined secondary indexes #129

tkadlec opened this issue Aug 29, 2024 · 1 comment

Comments

@tkadlec
Copy link

tkadlec commented Aug 29, 2024

I would love to be able to pass through a secondary index to both speed things up and filter out stuff I don't need.

Here's my specific use-case...

I have an "orders" table, an "items" table, and an accounts table.

Each item can be (but doesn't have to be) associated with an order. Each order and item are each associated with an account.

Right now, if I want to pull a page that shows all items for a user's account, and provide information about all orders as well, I think (unless I'm doing it wrong), I have to query:

  • to get all orders, then filter out any not related to the current account
  • to get all items, then filter out any not related to the current set of orders (account too I guess if I want to be super careful)

I'm sure there could be a structural change I could consider, but already, I feel like being able to limit the orders and items by the account by providing that as a secondary index would speed things up quite a bit (he says as if he's got any significant experience optimizing DynamoDB).

@tkadlec
Copy link
Author

tkadlec commented Aug 29, 2024

Just added a few timers to confirm, and the delay is indeed retrieving all the items. That data.get call takes ~401ms today, and as the number of users & items increases, that's gonna go up. Would love to figure out how to get that sucker cut down significantly.

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

1 participant