Query and Filter Table Items

Use a query when you know a partition key. Use a scan when you need to inspect items without a partition key value.

Choose Scan or Query

  • Query: Reads items with one exact partition key value. It can also use a sort key condition.
  • Scan: Reads items across the base table or a selected index.

Both modes can use DynamoDB filter expressions. A filter is applied after DynamoDB reads the candidate items.

Run a query

  1. Select Query.
  2. Select the base table, a global secondary index, or a local secondary index.
  3. Enter the exact partition key value for the selected key schema.
  4. Add a sort key condition when the selected key schema has a sort key.
  5. Select ascending or descending sort direction when it is available.
  6. Select Run Query.

Dynomate enables the query after you enter a valid partition key. Change a value and select Run Query, or refresh the table, to run it again.

Sort key operators are:

  • Equals
  • Begins with
  • Between
  • Greater than
  • Less than
  • Greater than or equal
  • Less than or equal

Sort direction controls DynamoDB sort-key order. It is different from a local grid column sort.

Dynomate query controls with an index selected and a nested attribute filter
Choose a key schema first, then add a post-query filter when needed.

Run a scan

  1. Select Scan.
  2. Select the base table or an index.
  3. Open filters when you need a filter expression.

Dynomate updates the scan after a short delay when you change its index or filter. There is no separate Run Scan button.

Build a filter

  1. Select Show Filters.
  2. Enter or select an attribute path.
  3. Select a value type.
  4. Select an operator.
  5. Enter the required value or values.
  6. Add more conditions when required.

Dynomate joins enabled conditions with AND. You can disable a condition without deleting it.

Available filter operators are:

  • Equals, not equal, less than, greater than, less than or equal, and greater than or equal.
  • Between and In.
  • Contains and Begins with for string values.
  • Exists and Not exists.
  • Size.

Boolean conditions support Equals, Not equal, Exists, and Not exists. Enter comma-separated values for In.

Filter nested attributes

Use dot notation for map values, such as profile.address.country. Use a numeric index for a list value, such as items[0].sku.

Dynomate learns attribute path suggestions from returned items and stores them locally for that table. A suggestion such as items[].sku describes values inside a list. Replace the wildcard with a numeric index before the filter runs.

You can enter a valid path that has not appeared in suggestions. In Query mode, the active partition and sort key attributes are not offered as post-query filter suggestions. Set those values in the key controls.

Read capacity and cost

Filters do not reduce read-capacity consumption

DynamoDB applies a filter after it reads the candidate items. A filter can reduce returned items, but it does not reduce consumed read capacity or the associated cost.

For an on-demand table, AWS bills read request units for the items read before the filter. For a provisioned table, the same reads consume the table or index read capacity units. Prefer Query when the access pattern has a partition key. A Scan can read a large part of a table or index and compete with application traffic.

AWS permissions

  • dynamodb:DescribeTable to load the key and index schema.
  • dynamodb:Query to run queries.
  • dynamodb:Scan to run scans.

Include the required table and index ARNs in the IAM resource scope.