-
Notifications
You must be signed in to change notification settings - Fork 131
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
Scan used instead of Query #123
Comments
The logic to determine Hope that helps |
Ok, thanks for the answer. I hope the logic will be enhanced soon. |
Yep, it's on my todo list. Feel free to list more scenarios here. |
@raphael-adam I'm taking a look at your last example:
Unfortunately, given that |
But I have a similar example: $book
# hash key
->where('author', 'Stephen King')
# range key
->where('year', '>=', 2000)
->where('non-key-column', '>', 10) Then we can use both key condition expression and filter expression. |
Closed in #138 |
@baopham
My Query
And this is what is returned when I dump the DynamoDbQuery.
|
Hello,
I noticed that when using the query builder, sometimes Scan is unnecessarily used instead of Query. For example in this case:
A table has a Global Secondary Index with Partition Key
author
and Sort Keyyear
.$book->where('author', 'Stephen King')->where('year', 'between', [2000, 2015])->get()
Query is used as expected.
$book->where('author', 'Stephen King')->get()
Query should be possible but Scan is used. Does this have a reason?
$book->where('author', 'Stephen King')->where('year', '>=', 2000)->where('year', '<=', 2015)->get()
Scan is used. Here it is not that easy since there are two conditions for the year. But you could use the first one as Key Condition Expression and the second one as Filter Expression in a Query.
In general I find it dangerous to have a fallback to Scan if Query is not possible (when working with large tables). What do think about to have in some kind to explicitly execute a Scan instead of a Query?
Regards, Raphael
The text was updated successfully, but these errors were encountered: