[ CONSISTENT ]
[ USING index ]
COUNT foobars WHERE foo = 'bar';
COUNT CONSISTENT foobars WHERE foo != 'bar' AND baz >= 3;
COUNT foobars WHERE (foo = 'bar' AND baz >= 3) USING 'baz-index';
This counts the number of matching items in your table. It is making a query,
so you must search using the hash key, and you may optionally also provide
the range key or an index.
The WHERE clause is mandatory. If you want a count of all elements in a table,
look at the table description.
- If this is present, use a read-consistent query
- The name of the table
- When the WHERE expression uses an indexed attribute, this allows you to
manually specify which index name to use for the query. It should generally
not be needed, as the DQL engine will automatically detect the correct
index to use for a query.
WHERE hkey = 'a' AND bar > 5 AND baz <= 16
WHERE hkey = 1 AND bar BEGINS WITH "prefix"
WHERE hkey = 1 AND bar BETWEEN (1, 100)