A scramble is a special table used by VerdictDB to speed up query processing. The information about the created scrambles is stored in its metadata table and is used at query time.
Syntax for Creating Scrambles¶
CREATE SCRAMBLE newSchema.newTable FROM originalSchema.originalTable [METHOD (uniform | hash)] [(ON | HASHCOLUMN) hashcolumn] [(SIZE | RATIO) sizeOfScramble]
newSchemamay be identical to
newTablemust be different from
newSchemais same as
- The user requires the write privilege for the
newSchemaschema and the read privilege for the
- METHOD must be either "uniform" or "hash". A uniform scramble is used for count, sum, avg, max, and min. A hash scramble is used for count-distinct.
- If a hash scramble is to be built, the
hashcolumnmust be present.
hashcolumnindicates the column that will appear within the count-distinct function (e.g.,
sizeOfScramble(default = 1.0) defines the relative size of the scramble to its original table and must be a float value between 0.0 and 1.0 (e.g.,
sizeOfScramble=0.1will create a scramble which size is 10% of the original table).
- The schema and table names can be quoted either using the double-quote (") or the backtick (`).
Syntax for Viewing Scrambles¶
This query will print the list of all scrambled tables that have been built.