Beginner6 min read

DynamoDB Table Size and Item Count

There's no SELECT COUNT(*) you can cheaply point at a DynamoDB table. DynamoDB gives you a free metadata estimate or a count from reading the table. If the number looks wrong after recent writes, check whether it came from DescribeTable or a scan.

How do I get the item count and size of a DynamoDB table?

Call DescribeTable: it returns ItemCount and TableSizeBytes for free, but both refresh only about every six hours (AWS API reference).

To count the items in the table, run a Scan with --select COUNT. It returns the count and bills for reading every item. A scan counts the items it sees while it runs, so a table that changes during the scan can yield a total that doesn't represent any single point in time.

You wantUseCostFreshness
Ballpark count + size, freeDescribeTablenone (metadata call)refreshed about every six hours
Total countScan with Select COUNTreads the whole tableas observed during the scan
Count for one keyQuery with Select COUNTreads the key's candidatesas observed during the query
Count of a filtered subsetScan/Query + filter + COUNTreads every evaluated itemas observed during the read

Method 1: DescribeTable (free, ~6 h stale)

DescribeTable is a metadata lookup: it reads no items, so it consumes no read capacity, and it carries the two numbers you're after:

aws dynamodb describe-table --table-name Tickets \
  --query 'Table.[ItemCount, TableSizeBytes]'

Both come with the same caveat, verbatim from the API reference: "DynamoDB updates this value approximately every six hours. Recent changes might not be reflected in this value." So a table you just bulk-loaded can report ItemCount: 0 for hours: the number is a snapshot from the last refresh.

The same response also carries per-index figures: every GSI and LSI reports its own ItemCount and IndexSizeBytes on the same six-hour cadence. Comparing a 's item count against the table's is a free health check: it tells you how many items actually carry the index key.

Method 2: exact count with Scan + Select COUNT

When "approximately, as of this morning" isn't good enough, count for real:

aws dynamodb scan --table-name Tickets --select COUNT --consistent-read

Facts to know before you run it, all from the Scan API reference:

  • COUNT "returns the number of matching items, rather than the matching items themselves": less network traffic, but "this uses the same quantity of read capacity units as getting the items". An exact count of a 100 GB table is a 100 GB read on your bill.
  • A single request still stops at 1 MB of data scanned; the response's Count "only return[s] the count of items specific to a single scan request". The CLI follows LastEvaluatedKey and sums the pages for you; in SDK code you loop and add — see pagination.
  • Strong consistency can make each item read strongly consistent, but Scan still provides no snapshot isolation. Use the total as an exact count for stable data that the scan can fully see.
  • On a big table, split the work with a parallel scan (--segment / --total-segments) and sum the per-segment counts.

Counting a subset

  • Items under one partition key: Query with --select COUNT reads only that key's items, so it's as cheap as the data is small. This is the right way to count an .
  • Items matching a filter: add a FilterExpression, but you pay to read every item counted in ScannedCount, not just Count. DynamoDB filters after reading, so "count the closed tickets" via a filtered scan pays for every ticket.
  • A high ScannedCount next to a small Count is the signature of a filter that wants to be a GSI; see filtering strategies.

For richer questions (counts per status, sums, averages) DynamoDB has no GROUP BY at all; the workarounds live in count, sum & aggregate. DynoTable's SQL Workbench runs GROUP BY and aggregates client-side, as GROUP BY in DynamoDB shows.

Table size and item count in DynoTable

DynoTable shows the estimates on every table and can run counts on demand. Every open table has a Settings button in the tab toolbar; the dialog it opens shows:

  • Primary key and secondary indexes: the table's shape at a glance.
  • Items · Size · Avg item: DynamoDB's own DescribeTable estimates, labeled as estimates, with the six-hour caveat one hover away.
  • Index table: under Indexing, a capped sampling scan (normal read costs) that feeds field autocomplete and the inferred TypeScript / Zod / JSON Schema export; see Table overview and indexing.
The Table dialog in DynoTable: keys and indexes, the Items / Size / Avg item estimate row, and the indexed-field list.
The Table dialog in DynoTable: keys and indexes, the Items / Size / Avg item estimate row, and the indexed-field list.

Ask the built-in AI agent for a count, sum or group breakdown. If the agent reports a partial result, narrow the query or finish the read before using the number as a total.

FAQ

Why is my DynamoDB item count wrong? ItemCount (and TableSizeBytes) refresh "approximately every six hours", so recent writes and deletes are not reflected yet. The console's table overview shows the same DescribeTable numbers, with the same lag. To count the items a full scan sees, run aws dynamodb scan --table-name X --select COUNT.

How do I count rows in DynamoDB exactly? aws dynamodb scan --table-name X --select COUNT --consistent-read. The CLI pages through the whole table and sums the per-page counts. This bills the same read capacity as fetching every item. Even a strongly consistent scan can see writes made during the scan, so pause writes and account for read consistency if you need an exact total at a point in time.

Is DescribeTable free? It doesn't consume read capacity. It's a metadata call, not a data read, so polling it won't touch your table's throughput.

How do I find the size of one item? DynamoDB meters by item size (rounded up per 1 KB written / 4 KB read). Paste an item into the item size calculator to see its billed size, and see the 400 KB item limit for the ceiling.

Does item count affect my bill? Yes, a little. Billable storage is your data's raw size plus a per-item overhead, so many tiny items cost more than their bytes suggest, and each index's storage bills too. Requests bill by item size × request count. Put your table's numbers into the pricing calculator to see the monthly picture across on-demand and provisioned modes.

Download DynoTable and open the Table dialog on any table to see its shape, estimates, and indexed fields.

By Dmitriy · Updated