Excerpt | ||
---|---|---|
| ||
Siddhi Wiki for patitions |
Info |
---|
Note: A single partition definition can be used by multiple queries. |
...
<define-partition> ::= define partition <partition-id> by <partition-type> {, <partition-type>}*
<partition-type> := <attribute-name> | range <condition> as <partition-key> {, <attribute-name> | range <condition> as <partition-key>}*
...
Following example shows a sample partition definition;
Defining a partition with an ID 'StockSymbol' which will partition any query that uses this particular partition definition by the 'symbol' attribute of 'stockStream' .
define partition StockSymbol by stockStream.symbol ;
...
Following example shows a sample definition for range partitioning.
Defining a partition with an ID 'StockVolume' which will partition any query that uses this particular partition definition by the range definitions;
namely if volume is less than 10 it will be sent to the partition 'SMALL', if it is between 10 and 100, then it would be sent to 'MEDIUM' partition, else
it would go to partition identified by key 'LARGE'.
define partition StockVolume by
range volume < 10 as 'SMALL',
range volume >= 10 && volume <= 100 as 'MEDIUM',
range volume > 100 as 'LARGE' ;
...