2

How long should it take to get a response for the statement SELECT count(*) FROM db_name on a SimpleDB table of millions of entries? (currently my table >16M).

Shouldn't there some sort of "pagination" using the next_token parameter if the operation takes too long? (it's been hanging there for minutes now!)

jldupont
  • 88,026
  • 55
  • 193
  • 310
  • Watch for this also.. http://stackoverflow.com/questions/433913/in-sql-is-there-a-difference-between-count-and-countfieldname – Charlie Brown Jul 13 '11 at 19:39
  • If you just want a count of rows in a table, can you use the DomainMetaData operation and look at the AttributeValueCount value? – Dan Grossman Jul 14 '11 at 08:23

2 Answers2

2

There's something wrong. No count query will take more than 5 seconds, because after 5 seconds it cuts off and gives you a next token.

If the count request takes more than five seconds, Amazon SimpleDB returns the number of items that it could count and a next token to return additional results. The client is responsible for accumulating the partial counts.

http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/CountingDataSelect.html

Dan Grossman
  • 50,627
  • 10
  • 109
  • 97
  • I've dig through the boto code: it seems that their `select` implementation fetches all the results i.e. it uses the `next_token` facility of SDB to perform the iteration. Mystery solved :) – jldupont Jul 14 '11 at 12:20
-1

SimpleDB responses are typically under 200ms, not counting data transfer speed (from Amazon's server to yours, which is less than 50ms if you're on EC2).

However, the total size of a SimpleDB response cannot exceed 2,500 rows or 1MB, whichever is smaller.

See "Limit" here http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/index.html?UsingSelect.html

pk1557
  • 508
  • 7
  • 21