Selection method properties

The Deephaven query engine select and update operations bring table data into memory. The default mode of operation preserves the address space of the input table. Depending on your data patterns, this address space preservation may use significant amounts of additional memory. To better understand how a query's memory is used, execute the following Groovy snippet to identify how much memory is wasted per table.

For example, we can create three tables with different address space patterns:

  • First, a raw ProcessEventLog (which has a dense address space, made up of one region per partition).
  • Second, a table filtered on Timestamp (which will have a contiguous subset of the addresses from each partition).
  • Third, a table using worker name (which is going to filter rows throughout the table without any inherent adjacency).
  • If we called these tables pelAllSelect, pelTimestampSel and pelWorkerSel, the snippet produces output similar to the following:

The efficiency is ideally 1.0, and we can see the pelAllSelect table very nearly reaches 1.0 as it has a dense address space. On the other hand, the pelTimestamp table is using 40% more space than ideal and the pelWorkerSel table is using more than 3 times as much memory as is optimal. In the worst case, a table that uses only one index key per 1024-entry block will require 1024 time as much memory as optimal.

If we were to flatten the pelWorkerSel table, and the rerun the snippet, we can see that a flat table has an ideal ratio of 1.0:

Preserving the original address space allows data to be read more quickly, but in workloads where it results in poor memory utilization or performance, the following optional properties for select and update may be configured:

  • QueryTable.redirectSelect
  • QueryTable.redirectUpdate

Both are false by default. If set to true, then select and update will create redirected column sources. These are more memory efficient, but potentially use more CPU as they require an internal hash table look-up to read or write values.