Scan with filter returns zero results in DynamoDB

0 votes
I have a table with approximately 300 000 rows in DynamoDB. It contains three columns: source, data and cycles. The source attribute is a hash key and data is a range key. The cycles attribute is a number which is added by the application each time a row is to be added. I used to scan these rows with the following filter:

However, this scanfilter spontaneously seems to have decided not to work properly anymore. Anytime I execute this request it will return zero results. When I remove the scanfilter it returns 20 results, so I assume it has nothing to do with the limit or tableName attributes. The funny thing is that when I set the filter to find items with cycles equals "1" it actually works, maybe because there are 10 rows with cycles = 1 at the start of the table.

My question is simply how to fix this. Should I add a new index, or should I change this scanfilter? I can also try to use the query command instead of scan, but my previous attempts to do this didn't work out either.
Mar 4, 2022 in Others by Edureka
• 13,690 points
1,190 views

1 answer to this question.

0 votes
By accessing all items in a table or a secondary index, the Scan action returns one or more items and item attributes. A FilterExpression action can be used to tell DynamoDB to return fewer entries. If the total number of scanned items exceeds the 1 MB maximum dataset size limit, the scan is terminated and the results are provided to the user as a LastEvaluatedKey value so that the scan can be resumed later. The number of items beyond the limit is also included in the results. If no table data meets the filter requirements after a scan, the scan will fail. A single Scan operation reads up to the maximum number of items set (if using the Limit option) or a maximum of 1 MB of data, after which any filtering is applied.

You must paginate the result set if LastEvaluatedKey appears in the response. In the Amazon DynamoDB Developer Guide, see Paginating the Results for more information.

Applications can request a parallel Scan operation by giving the Segment and TotalSegments options for quicker performance on a large table or secondary index. See the Amazon DynamoDB Developer Guide's Parallel Scan for more information.

When reading data in a table, Scan utilises eventually consistent reads; as a result, the return set may not include changes to the table data that occurred before the operation began. Set the ConsistentRead parameter to true if you need a consistent copy of the data when the Scan starts.
answered Mar 4, 2022 by gaurav
• 23,260 points

Related Questions In Others

0 votes
1 answer

How to Freeze Top Row and Apply Filter in Excel Automation with C#

Try this: // Fix first row workSheet.Activate(); workSheet.Application.ActiveWindow.SplitRow = 1; workSheet.Application.ActiveWindow.FreezePanes ...READ MORE

answered Oct 22, 2022 in Others by narikkadan
• 63,600 points
2,645 views
0 votes
1 answer

Filter outlook sent items in vba failing for emails with multiple recipients

The PR DISPLAY TO parameter provides a ...READ MORE

answered Feb 21, 2023 in Others by narikkadan
• 63,600 points
756 views
0 votes
1 answer
0 votes
1 answer

In order to learn Node.js, I should be familiar with which other technologies ?

I appreciate your decision, its the perfect ...READ MORE

answered Jul 31, 2019 in Others by ArchanaNagur
• 2,360 points
871 views
+1 vote
1 answer

Create a User Account in Windows 10 with PowerShell.

Hi@akhtar, To create a new user account without ...READ MORE

answered Oct 7, 2020 in Others by MD
• 95,460 points
812 views
–2 votes
0 answers
0 votes
1 answer

Enabling SEO Optimizer in Magento 1.7 returns 404 error page on frontend links

Modified Magento's stock .htaccess to fit my ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,600 points
601 views
0 votes
1 answer

ImageProcessing with AWS, Dynamodb

We show how to create a data ...READ MORE

answered Mar 10, 2022 in Others by gaurav
• 23,260 points
846 views
0 votes
1 answer

Change date format of cell in excel from dd.mm.yyyy to yyy/mm/dd ( excel version 2013 )

Hello :)   Excel’s Format Cells function can quickly ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
1,618 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP