8. C-Store Query Execution
The query optimizer will accept a SQL query and
construct a query plan of execution nodes. In this section,
we describe the nodes that can appear in a plan and then
the architecture of the optimizer itself.
8.1 Query Operators and Plan Format
There are 10 node types and each accepts operands or
produces results of type projection (Proj), column
(Col), or bitstring (Bits). A projection is simply a set of
columns with the same cardinality and ordering. A
bitstring is a list of zeros and ones indicating whether the
associated values are present in the record subset being
described. In addition, C-Store query operators accept
predicates (Pred), join indexes (JI), attribute names
(Att), and expressions (Exp) as arguments.
Join indexes and bitstrings are simply special types of
columns. Thus, they also can be included in projections
and used as inputs to operators where appropriate.
We briefly summarize each operator below.
1. Decompress converts a compressed column to an
uncompressed (Type 4) representation.
2. Select is equivalent to the selection operator of
the relational algebra (s), but rather than producing a
restriction of its input, instead produces a bitstring
representation of the result.
3. Mask accepts a bitstring B and projection Cs, and
restricts Cs by emitting only those values whose
corresponding bits in B are 1.
4. Project equivalent to the projection operator of
the relational algebra (p).
5. Sort sorts all columns in a projection by some
subset of those columns (the sort columns).
6. Aggregation Operators compute SQL-like
aggregates over a named column, and for each group
identified by the values in a projection.
7. Concat combines one or more projections sorted in
the same order into a single projection
8. Permute permutes a projection according to the
ordering defined by a join index.
9. Join joins two projections according to a predicate
that correlates them.
10. Bitstring Operators BAnd produces the
bitwise AND of two bitstrings. BOr produces a bitwise
OR. BNot produces the complement of a bitstring.