Search code examples
nosqlamazon-web-servicesamazon-simpledb

Search over Item IDs in Amazon SDB


Is it possible to search through Item IDs in Amazon SDB, something like:

SELECT * FROM myDomain WHERE ItemName like '1234%'

I'm new to nosql, making first app with Amazon SimpleDB, figuring out best schema for my data.

Was thinking of making ItemName a concatenation of userId, topicId and, say, a timestamp - for a forum, for instance. So that getting all posts of a single user would be by searching through ItemNames, which are, I suppose, indexed - perhaps, a faster search.

Or should I just assign unique IDs to my items and never bother with their sorting, naming convention etc. - doing search only through Attributes?


Solution

  • Yes.. you search through Item IDs in Amazon SimpleDB and you can even sort your data using item IDs too. Here are some examples of query -

    select * from domain where itemName() like '1234%'
    select * from domain limit N
    select * from domain where itemName() like '1234%' order by itemName() limit 2500.
    

    For more details you refer following documentation -

    http://www.sdbexplorer.com/documentation/simpledb--how-to-run-select-query.html http://aws.amazon.com/articles/1232 http://aws.amazon.com/articles/1231

    Disclosure: I'm a developer of SDB Explorer.