So I think the issue here is that, by default, this query will perform a scan operation and then a filter on the scanned items. By default, I think the number that it returns is 10, so if your item is not contained in the first 10 items it will return zero and a next token.
You could instead update the operation to be a query vs a scan (by using the @key directive), or you could increase the limit.
This is more of a quirk / implementation detail of DynamoDB than anything else.
The scan operation will scan every item in a db (or the first n items if we set a limit, in our case 1) and then perform a filter on those results. By contrast, a query will only query on a set key, so in general for larger data sets a query is the way to go.
Yeah, it seems like a DynamoDB quirk. I only had about 4 records and limit: 1 to test filtering.
I never jumped on the NoSQL bandwagon. Give me SQL anyday. I find most data, for 99% of applications out there, is relational. Not to mention most won't run up against scaling issues with just using Postgres.
Have you thought about doing this same Amplify GraphQL example with Amazon Aurora Serverless? I think it'd be great to compare them side-by-side.
One of my favorite videos that shows what NoSQL can do is this one: youtube.com/watch?v=HaEPXoXVf2k , it also goes into theory around by NoSQL has become so popular. We're definitely working on more support as well for relational databases, you'll see more from us later this year.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So I think the issue here is that, by default, this query will perform a
scan
operation and then afilter
on the scanned items. By default, I think the number that it returns is 10, so if your item is not contained in the first 10 items it will return zero and a next token.You could instead update the operation to be a
query
vs ascan
(by using the@key
directive), or you could increase the limit.This is more of a quirk / implementation detail of DynamoDB than anything else.
The
scan
operation will scan every item in a db (or the firstn
items if we set a limit, in our case 1) and then perform a filter on those results. By contrast, aquery
will only query on a set key, so in general for larger data sets a query is the way to go.aws-amplify.github.io/docs/cli-too...
Yeah, it seems like a DynamoDB quirk. I only had about 4 records and
limit: 1
to test filtering.I never jumped on the NoSQL bandwagon. Give me SQL anyday. I find most data, for 99% of applications out there, is relational. Not to mention most won't run up against scaling issues with just using Postgres.
Have you thought about doing this same Amplify GraphQL example with Amazon Aurora Serverless? I think it'd be great to compare them side-by-side.
One of my favorite videos that shows what NoSQL can do is this one: youtube.com/watch?v=HaEPXoXVf2k , it also goes into theory around by NoSQL has become so popular. We're definitely working on more support as well for relational databases, you'll see more from us later this year.