11.23.Vectored Execution and Query Parallelization

Note: This feature only applies to Virtuoso 7.0 and later.

Vectored execution means executing queries or stored procedures simultaneously on multiple sets of parameters. Further, when a query contains a JOIN , a single invocation of the query will, with vectored execution, execute every consecutive JOIN step with multiple inputs. When every stage of a query's evaluation is performed on a large number of intermediate result rows at a time, two benefits are obtained:

  1. The interpretation overhead disappears and

  2. Locality of reference in

    JOINs

    can be better exploited.

For example, with a JOIN like:

SELECT  COUNT(*)
  FROM  part,
        lineitem
 WHERE  l_partkey = p_partkey
   AND     p_size < 23
OPTION  ( LOOP, ORDER );

the outermost LOOP of the query will look for parts with p_size < 23 . The part keys of these are used as lookup keys for an index on l_partkey in lineitem . This index translates these values into values of the primary key, l_orderkey , l_linenumber , which is then used to get the data row with the price and discount. When each of these steps is done with tens of thousands of values at the same time, the SQL interpretation overhead is almost completely eliminated and locality can be exploited when accessing nearby rows. The chance of hitting nearby rows also increases when the size of the intermediate result batch increases.