Optimization

Updated on Monday, 21 November, 2011 - 15:31

CSDL stream definitions can be complex. There are numerous ways to optimize them to increase speed and reduce costs.

Combining Multiple Filters into one "in" Statement

If you are testing several values against a single target and you are not doing anything very complex, it may be worth combining them together into an in statement to reduce costs and processing overheads. The in operator is heavily optimized.

For example, this stream definition:

could be much cheaper to run by using an in statement instead:

Or you can use the operator to combine multiple Twitter ids like this:

Combining Multiple Filters into one "contains_any" Statement

It is possible to optimize multiple contains operations combined with OR operators into a contains_any operation.

For example, this stream definition:

can be optimized like this: