Single vs. Multiple Predicate Queries

The performance of any given query is dependent on your dataset, the queries you construct, and the access pattern of your application. Two queries that are syntactically correct and produce the same result sets might have different performance characteristics. The Amazon SimpleDB query language allows you to accomplish the same goal in multiple different ways, but it is up to you to choose the best query expressions for your needs.

Following is an example of two queries on multiple values for a single attribute. Both of these query expressions are syntactically correct:

Query 1: ["attribute1" > "value1" and "attribute1" < "value2"]
Query 2: ["attribute1" > "value1"] intersection ["attribute1" < "value2"]

If your dataset contains items that have the same set of single-valued attributes, both of the queries should produce the same result set. However, because the first query contains a single predicate, it is likely to perform better than the second one.