Elamur Research

FSST

Paper · 2020 · Peter A. Boncz, Thomas Neumann and Viktor Leis

Summary

A database can hold many strings that share pieces of text even when very few of the complete values repeat. Web addresses may share a protocol or part of a domain, for instance, while each address still names a different resource. A dictionary that assigns an integer to each distinct value can remove duplicate addresses, but it still has to store the distinct addresses themselves. A general-purpose compressor can find repetition across those addresses by packing them into a block. That saves space at a cost when a query wants only one value, because the database may have to decompress the block to retrieve it. Fast Static Symbol Table, or FSST, is designed to capture the shared pieces while keeping each string independently readable.

FSST learns a table of recurring byte sequences from a sample. Each sequence in the table can stand for between 1 and 8 original bytes and is represented by a single byte in the compressed string. An escape marker lets the encoder carry through any byte that the table cannot represent at the current position. The whole group of strings shares the table, and decoding leaves it unchanged. Once the database has located a compressed value, the decoder can expand its codes by looking them up in that table. The same property lets a query compare a compressed column with a constant by encoding the constant with the column's table and comparing the resulting bytes.

Choosing the table is harder than using it. Two apparently valuable sequences may cover the same bytes, so frequency counts from the original text can give both credit for an occurrence that the encoder can use only once. FSST builds its table in rounds. It encodes a sample with the current table, counts which symbols the encoder actually uses, and tries longer symbols made from adjacent pieces. The paper also develops a fast scalar encoder and an AVX512 implementation that works on several strings in parallel. The authors released the C++ implementation, their dbtext corpus, and a replication package.

On dbtext in file mode, where each column was treated as an 8MB file, FSST achieved an average compression factor of 2.28×, compared with 1.70× for LZ4. FSST encoded the corpus faster on average, while bulk decoding speeds were almost equal on average. In the separate string-by-string setting, FSST retained a compression factor of 2.19× and could retrieve selected values without expanding their neighbors. The Umbra database prototype shows how these properties can affect queries. On TPC-H SF10, most runtimes changed little, while some queries benefited from smaller strings and direct filtering on compressed values. The amount of space saved in Umbra's string pool also depended on whether a value became short enough to store inside its row representation.

Deep dive: FSST

FSST compresses repeated byte sequences in database strings so individual values can be read without decoding a whole block. · about 38 minutes to read

The problem and its context

The redundancy inside distinct values

Strings are a common storage type for values as different as comments and machine identifiers. A comment field may contain recognizable words and phrases. A field of email addresses may contain repeated pieces associated with domains. The database still sees both as strings, a representation flexible enough to hold text with very different internal structure. The authors draw attention to the cost of that flexibility. Strings can account for a large share of the bytes a system stores and moves, and many of the values it stores are short. The paper characterizes them as generally below 200 bytes and frequently below 30 bytes per value.

The usual database dictionary works at the level of complete values. The system stores a unique string once and uses an integer code for its occurrences in the column. The resulting integer column may itself be compressed. How much this saves depends on how often complete values recur. If addresses share a beginning but differ in the rest, a whole-value dictionary gives each distinct address a separate entry. It can save the space occupied by exact duplicates, but the common beginning can still occupy space in many dictionary entries. If the dictionary is scoped to a row group or block, a repetition outside that scope does not help it deduplicate values within the group.

FSST addresses the bytes that remain after that operation. The authors see the schemes as complementary. A column can use integer codes to refer to dictionary entries, while the unique strings in the dictionary can be stored in FSST form. Access then has two levels. The column's integer identifies a particular entry. FSST's byte codes reconstruct the contents of that entry. Each representation exploits a different kind of repetition, and the value of the second layer can remain high even if the first has already removed every duplicate string.

Access determines the useful compression unit

A general-purpose method such as LZ4 can look for redundancy in a span of bytes containing many values. The paper explains that a span of several kilobytes gives such methods room to work, whereas a short database string in isolation offers few opportunities. A columnar system can supply the larger unit by compressing many strings together on disk. That arrangement suits a reader that needs their contents in sequence. It makes selective access more expensive when the block must be expanded to get at a subset of its strings.

A scan can illustrate what changes. A query may first use another column to decide which rows qualify. It then needs the string values for those rows. If a compressed block contains both qualifying and unqualified rows, block decoding expands bytes for both. The query has saved work in deciding which values to inspect, yet it may still incur decompression work for their neighbors. The issue also arises away from scans. An index lookup, a hash-table access during a join, or an operation that revisits values during aggregation may need strings in an order different from their storage order.

FSST separates the scope of shared compression information from the scope of decoding. A group of values contributes evidence about common byte sequences. Once that evidence has been turned into a fixed table, each value can be encoded and expanded on its own. A system still needs a way to locate each value and associate it with its table. The change is that, after locating it, the system does not need the decoding history of the strings that precede it.

This distinction also changes when a query needs to expand strings. A plan can carry compressed values through operators that only copy or forward them. Operators that inspect the original contents can decode at the point of use. The authors also identify operations that require less than the full contents. If a filter asks whether a value equals a constant, deterministic encoding with a common table gives the query two byte sequences it can compare directly. A compressor intended for this setting therefore has to be evaluated on access and query behavior as well as on byte savings.

What earlier schemes offered

The authors describe a literature that had concentrated much of its lightweight compression work on integers. They discuss string-specific alternatives in terms of the regularities those alternatives exploit and the work needed to retrieve a value.

One alternative stores a sorted dictionary in a structure combining features of a trie and a B-tree. Neighboring entries are likely to have related beginnings, so the representation records differences after their shared prefix. It periodically stores a complete string to give a reader a place to start reconstructing nearby entries. The paper gives 16 as an example spacing for those complete values. URLs can suit prefix compression because related addresses frequently begin alike. A collection of UUIDs may offer little common prefix to remove. The paper also notes that a global dictionary can raise the cost of updates, a separate consideration from how compactly it stores text.

A variant of LZ78 developed by Arz and Fischer also supports access to individual compressed dictionary entries. The concern in this case is the cost of expansion. According to the authors, decoding takes over one microsecond for strings that are 19 units long on average. For the workloads motivating FSST, a decoder has to be cheap enough that access to short values remains practical when repeated throughout a query. The existence of an independently decodable representation addresses only part of that requirement.

PostgreSQL's TOAST approach illustrates a different choice. As described in the paper, it uses an LZ-family method for values larger than 2 KB and leaves smaller values uncompressed. That threshold gives a general-purpose technique more text to work with. It leaves open the problem that motivated FSST, namely how to reduce the space occupied by many short values while preserving access to each one.

Byte Pair and RePair come closer to the representation FSST pursues. Byte Pair counts adjacent bytes and uses byte values absent from the input to stand for common pairs. It can repeat the substitution process with the newly assigned codes. An absent byte is useful as a code precisely because it cannot be confused with literal input. The same rule makes an existing table difficult to reuse on unseen data that may contain those byte values. Recursive substitutions also mean that a reader may have to make several expansion steps to recover the underlying bytes.

RePair builds a hierarchy by repeatedly replacing common adjacent symbols with a newly created symbol. Selection changes the sequence of symbols on which the next round of counts is based. That captures an important feature of the construction problem, since changing the representation changes which neighbors are visible. The paper describes the resulting hierarchy as costly to build and comparatively slow to decode. It cites an AVX512 decoding implementation of RePair with throughput below 100MB/s. These prior approaches help explain FSST's insistence on a flat table. Its builder can use successive generations to discover longer sequences, while the finished representation gives the decoder each symbol's full expansion directly.

The method, step by step

From a string to byte codes and back

An FSST symbol is a sequence of input bytes. Its length can be anywhere from 1 to 8 bytes. The unit matters because the method works at byte boundaries. It can learn sequences that happen to correspond to words or parts of words, but its definition of a match is simply equality of the bytes. For a collection of web addresses, a protocol prefix or a often repeated piece of a domain can become a symbol. The encoder applies the same rule to a recurrent pattern in an identifier or a text field.

A symbol table assigns a byte code to each selected sequence. When the encoder reaches a position in a string, it looks for the longest table entry matching the bytes that begin there. If there is a match, the encoder writes the code and advances by the length of that entry in the original string. The next search starts at the new position. The encoder thereby chooses a partition of the input into pieces that it can represent as table entries or literal bytes.

Code 255 is reserved for the literal case. When no table entry fits, the encoder writes that escape code and then the current input byte. It advances past the original byte and resumes searching. A decoder encountering the escape code copies the byte that follows it as data. That second byte can have any value, including the value assigned to the escape marker itself. Its position immediately after the marker establishes how to interpret it. With this convention the format has room for 255 actual table entries, and an existing table can represent input that was absent from its training sample.

The following flow starts with the sample used to construct the table and ends with one access to the encoded data.

Building and using an FSST symbol table

The steps in order.

Building and using an FSST symbol tableStep 1: Sample bytes from the string collection1. Sample bytes from the string collectionStep 2: Encode the sample and count neighboring symbols2. Encode the sample and count neighboring symbolsStep 3: Rank observed symbols and candidate extensions3. Rank observed symbols and candidate extensionsStep 4: Repeat counting with the revised table4. Repeat counting with the revised tableStep 5: Fix the table and encode each string5. Fix the table and encode each stringStep 6: Locate the compressed string requested by the query6. Locate the compressed string requested by the queryStep 7: Expand codes and copy escaped bytes7. Expand codes and copy escaped bytes

Decoding proceeds from the start of the requested compressed value. A normal code identifies a single entry whose bytes are appended to the output. The entry already contains its full byte sequence. Even if the builder discovered it by joining two shorter symbols, those shorter symbols are irrelevant to decoding it. An escape instead advances the compressed input past the marker and its literal byte. The decoder needs the appropriate table and the compressed value's boundary, which the surrounding storage representation supplies.

The decoder's working representation

FSST makes the fixed size of the codes do much of the implementation work. A normal byte code can index an array. The decoder keeps the bytes of a symbol in a machine word and its actual length in a separate array. It can store the whole 64-bit word at the output position and move that position by the true symbol length. For a shorter symbol, the next store can overwrite the extra bytes from the first store. The logical output boundary follows the sum of the actual advances. This arrangement uses the processor's support for fast stores at addresses that need not line up with machine-word boundaries.

The paper describes a symbol array of 2048 byte and a length array of 256 byte in this decoding layout. Both fit comfortably into the level 1 cache on the processors the authors have in mind. The in-memory arrays hold fixed-width slots for quick lookup. A table carried with a block can instead represent its symbols by their actual lengths. The paper gives the following size bound for the stored symbol entries and their lengths.

Bₘₐₓ = 8 × 255 + 255

Here Bₘₐₓ is the bound in bytes for those contents. The first 255 counts the available entries and 8 bounds the number of symbol bytes in each. The last 255 allows for their lengths. The authors say that tables typically occupy only a few hundred bytes because actual entries are usually short. Metadata needed by an encoder, including the terminator discussed below, also has to be carried when the table is serialized.

Escaping adds a decision to the basic decode loop. In the branch for a normal code, the decoder fetches the symbol and its length. In the escape case, it copies the next byte from the compressed input. The authors reason that a byte escaped frequently enough would be a candidate for a table entry, which helps make escape handling infrequent on their text data. The implementation looks ahead at a 4-byte word and tests whether it contains the escape value. When it can rule out escapes, it expands the codes together without repeating the test for each one. A path for input containing escapes uses Duff's device, a programming technique for arranging the entry points and work in a partially unrolled sequence.

The word-sized stores and grouped escape checks change how quickly the decoder produces an answer. The logical expansion remains a succession of table lookups and literal copies. This is why the decoder can begin with the desired string rather than running from the start of the compression group. Its output pointer depends on what it has decoded in the current string, and its table contents are the same regardless of which value was decoded before it.

Why the table is learned by encoding

If all candidate symbols could be used independently, one could count byte sequences, rank them by frequency and length, and choose the highest-ranked entries. But using a symbol commits the encoder to consuming its entire span. A different sequence beginning inside that span may occur just as often in the source and still contribute little once the first is in the table. The paper illustrates this with overlapping windows near the beginning of web addresses. A window can look valuable because it includes much of a common prefix, even if the encoder typically consumes that prefix starting at an earlier byte.

A similar dependency arises when a long match moves the encoder past the start of a potentially useful symbol. At the current position, the longest match can consume the opening byte of a sequence that would have saved more across the rest of the string. To choose globally among such possibilities, the authors tried an encoder based on dynamic programming. It considers how local choices will affect the cost of the remaining input. The production design uses the greedy rule because the experiments found little improvement in space from the more expensive search. That choice makes it especially important to judge a table under the actual rule the final encoder will use.

The score used to rank a symbol has the same shape whether the frequency comes from the raw input or from trial encoding.

g(s) = f(s) × ℓ(s)

Here s is a candidate byte sequence, g(s) is its score, f(s) is the relevant occurrence count, and ℓ(s) is the sequence's length in bytes. The authors call a score based on raw substring frequency static gain. In the bottom-up builder, the count instead comes from the encoding pass, either for a symbol used during that pass or for pieces observed together that suggest a new candidate. The product is a ranking heuristic. The actual savings depend on which candidates survive together and how the next encoding pass uses them. A single byte in the table can also save space because its code replaces the marker and literal used by an escape, even though its expansion is itself a single byte.

The paper uses the size of the search space to explain why exhaustive construction is impractical. For input length N, it gives an upper bound on the number of candidates obtained by looking at possible starting positions and lengths.

S ≤ N × 8

S is the number of distinct candidate byte sequences in that count, N is the text length, and 8 is the maximum number of lengths to consider at a position. The bound counts many potential occurrences that can coincide as byte sequences or run into a boundary. For the problem of filling a table with 255 entries, the corresponding bound on candidate collections is expressed as a binomial coefficient.

C(8N, 255)

C(a, b) denotes the number of ways to choose b entries from a candidates without regard to order. Here a is the bound 8N on the candidate pool, and b is the table capacity 255. The paper also considers narrowing the pool to strong candidates from a sample.

C(3000, 255)

The same notation now describes choosing the table from 3000 candidates ranked by static gain. The authors report that this count still has 378 digits. A trial encoding can evaluate a particular table by walking through the input. Testing enough tables to establish an optimum is the difficulty. FSST instead limits the search to successive revisions informed by actual encodings.

What happens in each round

The first round begins with an empty table of real symbols. The construction code keeps 256 pseudo-symbols for the possible literal bytes. These are accounting entries that let the builder treat an escaped byte as a unit of input while tracking how it was represented. With the real table empty, every byte would be escaped. The builder can collect statistics for this representation without materializing all of its compressed bytes.

As it walks through the sample, the builder records the frequency of individual codes or literal bytes and the frequency of successive pieces. The single-item counts show how frequently the encoder found a particular entry useful. The pair counts expose sequences that the table had to represent in separate steps. The concatenation of those pieces is a possible new entry, within the length bound. In the first round every piece is a literal byte, so adjacent observations already supply candidates longer than a single byte.

The procedure also records an extension by the next input byte when the next piece starts with a longer real symbol. This matters because extending the preceding symbol by that whole piece may be a poor choice, while extending it just by the first byte can produce a useful alternative. The builder keeps reconsidering single bytes as well. Those rules give a promising short entry a way back into the candidate pool after it has been displaced by a longer entry. Otherwise the search could discard a useful short sequence and lose the ability to assemble a later candidate from it.

The candidates for the new table thus come from existing symbols, single bytes, and concatenations suggested by the counts. The builder ranks them by apparent gain and selects the strongest entries up to the available capacity. It then encodes again with the revised set. A candidate that looked attractive as an adjacent pair may appear hardly at all when tested alongside other additions. Its changed count in the next pass gives the builder a reason to drop it. With a fixed table capacity, symbol length bound, and number of rounds, the authors describe the process as linear in the size of the text it processes.

The paper demonstrates this feedback with a small character sequence and a table restricted to 5 entries with maximum symbol length 3. In the first round, the empty table requires every character to be escaped. The candidates um and tu each have a gain of 4 because each occurs twice and covers two bytes per occurrence. Several other candidates have a gain of 2. The example resolves that tie arbitrarily. Later, tu survives alongside tum for one generation, even though the longer symbol consumes the positions where the shorter one would have been used. The next pass exposes that lack of use and the shorter candidate drops out. After iteration 4 the example is represented in 5 bytes, from an original length of 13. That example follows the changing choices of the table builder. It is an illustration of the feedback process on the encoded sequence, separate from the corpus measurements.

Sampling and the number of rounds

The round count affects what the builder can discover. Starting from literal bytes, it can form symbols of size 1-2 after the first iteration. Pairing pieces again can take it to size 2-4 after the second and to the maximum size of 8 after the third. Useful shorter entries remain eligible throughout. Additional passes let the builder see how the longer and shorter entries compete under the encoder's matching rule. The authors report that 5 iterations were generally enough to obtain a good compression factor.

The escape representation lets the builder work on a sample. A byte that never appeared in the sample can still be written literally when the final table is used. This separates the risk of an unrepresentative sample from the correctness of the representation. A poor sample may miss profitable sequence choices, but the encoder will still be able to express the data. The authors found that modest samples gave compression factors close to those from training on the full corpus. The released compression utility uses a 16KB sample for each 4MB chunk of string data.

The implementation further reduces how much of that sample it reads in early iterations. It grows the portion used from 6% to 100% linearly over the 5 passes. The early tables can only contain short entries, so the builder does the work of testing a broader sample once it has developed longer candidates to compare. Pair counting is also arranged to favor frequent access to the smallest part of each counter. The implementation splits the 256K pair counters into 4 low bits and 12 high bits, with the latter accessed less frequently. This reduces the memory footprint of the often updated portion.

A table can be shared at several storage levels. The paper discusses a separate table for a page of a string column, as well as tables shared at row-group or whole-table scope. A narrower group gives construction the chance to fit its particular strings more closely. The system then has more table associations to keep track of when reading the strings or comparing them. For parallel loading, workers can build separate tables for independently handled chunks, with each table stored along with its block. Once the table is fixed, encoding and decoding values introduce no shared evolving compression state.

Finding a match without searching a list

The simple match procedure groups entries by their first byte. Within each group, it arranges entries so that a longer sequence comes before any entry that is its prefix. The first successful comparison gives the longest match, since two sequences that both match at the current input position must agree up to the end of the shorter one. This gives a straightforward way to understand what the encoder is doing, but the number of candidates it tests can vary from position to position. The optimized encoder replaces that search with two direct lookups.

For symbols of 1 or 2 bytes, FSST uses a lookup indexed by the next two input bytes. The array has 65,536 entries. It installs the codes for two-byte symbols first. Where a slot is still empty, it can contain the code for a single-byte symbol matching the first byte of the index. In the remaining slots the lookup returns the internal representation for an escape. One read thus supplies the best short match or the fallback.

Longer symbols use a hash table indexed by their first three bytes. The lookup inspects a single bucket and then checks whether the candidate actually matches the full prefix at the current position. Two symbols can compete for a bucket because they begin with the same three bytes or because different prefixes lead to the same bucket. When the builder encounters this competition, it keeps the symbol with the higher apparent gain and considers other candidates for the remaining code slots. The authors call this lossy perfect hashing. What can be lost is a candidate during table construction. The output strings are still recoverable byte for byte, and the encoder verifies a long match before emitting its code.

The hash calculation is written as follows in the scalar implementation.

h(x) = (x × 2971215073) ⊕ (x ≫ 15)

h(x) is the hash of x, the integer holding the three-byte key. 2971215073 is the multiplier used by the implementation. The symbol ⊕ denotes bitwise exclusive OR, and ≫ 15 shifts the key right by 15 bits. The implementation masks the result to obtain a bucket index in a table with 4096 slots. One bucket read yields the only long candidate the current table can offer for that index. The encoder still has to check both that the bucket is occupied and that the candidate's bytes agree with the input.

The match checks can treat both the candidate and the input as machine words. For a short symbol stored in a word, only part of the loaded input should participate in the comparison.

u = 64 − 8 × ℓ

u is the number of irrelevant bits in a word of 64 bits, ℓ is the symbol length in bytes, and 8 is the number of bits per byte. The implementation stores u with the symbol. It uses that information to mask the input before the equality test. If the long candidate matches, its length makes it the preferred choice. Otherwise the code from the short lookup determines what to emit. A conditional move can make this choice without a branch in the match kernel.

Writing the output and stopping at a boundary

The scalar kernel uses internal code words that carry more than the byte eventually written to the compressed string. It packs the input advance into bits 12-15 and uses the ninth bit to distinguish a normal symbol from the escape case. The internal escape value is 511 in its code field. When written as a byte, it becomes 255. Before the encoder finishes choosing the code, it writes the current input byte into the second output position. That write is required for an escape. For a normal symbol, the logical output advances by a single byte, so the second position can be reused by the next emission.

The packed representation gives the scalar code the following output advance.

Δout = 2 − ((c ≫ 8) & 1)

Δout is the output advance in bytes and c is the packed code word. The right shift ≫ 8 brings the ninth bit down to the low position. The bitwise AND operator & with 1 isolates it. The bit is set for a normal symbol, yielding a one-byte advance, and clear for an escape, which uses 2 output bytes.

Δin = c ≫ 12

Δin is the number of input bytes consumed, c is again the packed code word, and the shift ≫ 12 extracts the length from the high bits. For an escape this advance covers the original literal byte. These fixed operations handle both forms of output with the same sequence of instructions in the kernel.

The word-sized input load also creates a boundary question. To find a match near the end of a string or segment, the encoder may look at a word extending beyond the data it intends to consume. The authors use a terminator byte and exclude it from symbols longer than 1. They put that byte just after the data to be encoded, so a match beginning inside the data cannot consume bytes across the boundary. The ordinary mode chooses the least frequent byte in the input corpus as the terminator. The optional mode for zero-terminated strings uses byte 0. In that mode code 0 represents the zero-byte symbol, leaving 254 codes available for compressing the other contents.

The scalar and vector paths both use boundaries at 511-byte input segments. This makes their outputs consistent. Given the same table, a string must be split at the same places and matched according to the same rules whichever kernel processes it. Otherwise a long symbol could be used across a boundary by one path and rejected by the other. For direct equality testing, it matters that a value encoded in one batch compares equal to the same value encoded later, even if the later batch follows a different execution path.

Keeping the vector lanes busy

The AVX512 encoder performs several independent lookups and emissions in parallel. Each lane works on a different segment. The enclosing code copies strings into a temporary buffer, splits long strings as needed, and appends the terminator to each segment. The buffer can hold 512 segments. The paper describes batches of 100 or more strings as preferable, while a smaller number can still provide enough work when their total size reaches a few tens of KB. For strings shorter than 10 bytes, the implementation uses the scalar path. It also uses scalar encoding on architectures without AVX512.

A vector iteration does for each active segment what the scalar kernel does for its current input position. It reads the next bytes, looks up a possible short code and a possible long code, verifies the long match, and writes the selected result. The positions can differ in every lane. Gather and scatter instructions let the kernel fetch from and write to those different addresses. Each lane keeps a packed job description so that the kernel can update its current position and recognize when it reaches the end. The same descriptor carries enough information to locate its output and put completed segments back in the right order.

The authors pack that bookkeeping into a word with the following allocation.

18 + 18 + 19 + 9 = 64

Each 18 is the width in bits of an input offset, one for the current position and one for the end. The 19 bits hold the output offset, which needs more room because escape-heavy output can be twice the input size. The 9 bits identify a job in the batch. The 64 on the right is the total width of the packed job description. Keeping it in one lane reduces the number of registers the kernel needs, which leaves room for multiple independent groups of jobs.

The most successful version processes 24 strings in parallel by unrolling the kernel 3×. Unrolling interleaves independent work, which lets operations on other segments proceed while a memory instruction is still pending. The authors point out that gather instructions have substantial latency and can be overlapped. The benefit of the vector implementation comes from combining that overlap with parallel matching and bookkeeping. A vector implementation that issued work for just one initial group and waited for every segment to finish would tend to have unused lanes toward the end, because strings vary in length and in how far a match advances.

To keep its working lanes occupied, the encoder orders queued jobs by decreasing input length. It starts the longer ones earlier, retires completed jobs, and refills the vacated lanes from the queue. Completed jobs can leave in a different order from the one in which they entered, which is why the job identifier travels with the offsets. The vector loop continues while it can keep enough lanes active. The enclosing code can finish remaining work with the scalar kernel. These arrangements govern throughput, while the byte format and decoding table remain the same.

Experiments and results

The corpus and the measurements

The authors assembled dbtext to represent the variety of strings they encounter in databases. It contains 23 columns. Samples include machine identifiers such as email addresses and URLs, names such as cities and movie titles, and longer text such as passages from Wikipedia. It also includes domain-specific data represented as strings and string fields from TPC-H. The shortest column mean cited in the paper is 7 for firstname, and the longest is 130 for wikipedia. That is a range of average lengths across columns, so it describes the typical work per value in different parts of the corpus.

The corpus includes inputs for which a specialized data type could be a better representation, such as UUIDs and genome data. The authors include them because such values are often stored as strings in practice. This makes the corpus a test of the representation the compressor is likely to receive. It also means the measured compression factors apply to the byte representation tested. A system that changes the type or reorganizes a field before compression changes the input and may remove some of the patterns available to FSST.

The main comparison uses LZ4 version 1.8.1. The workstation had 32GB RAM and a 3.3GHz i9-7900X with 10 cores and two AVX512 execution units per core. The codec experiments use single-threaded execution. The later Umbra measurements use 20 threads, which makes them a separate test of how compressed strings behave inside a parallel query engine.

The compression factor measures original size relative to compressed size. A larger factor means a smaller compressed representation for the same input. The paper also measures bulk compression and decompression throughput, which answer how quickly the codecs can process a stream of input or produce the recovered text. An encoding kernel's cost is reported in cycles per input byte. Database execution time includes the remaining work of the query, so it can reflect memory traffic, allocation, predicate evaluation, and operators that see little or no string data.

Large files give LZ4 a favorable comparison

In the file experiment the authors concatenate values to make an 8MB file for each column. This arrangement supplies large inputs to the block compressor and sets aside FSST's ability to decode individual strings. It asks how the codecs compare when both can process the whole input in bulk. Newlines are part of the file representation, so the result concerns that representation of dbtext.

Average compression factor on dbtext in file mode

FSST represents the same textual corpus more compactly in the bulk comparison.

Average compression factor on dbtext in file modeLZ4: 1.70LZ41.70FSST (this paper): 2.28FSST (this paper)2.28
The numbers
System or settingcompression factor ×
LZ41.70
FSST (this paper)2.28

FSST's compression factors extend from 1.63× on wiki to 3.84× on c_name in this experiment. The column named wiki is distinct from wikipedia in dbtext. The variation matters because the code table can exploit only the byte patterns frequent enough to earn entries, and those patterns differ by column. Across the corpus the authors report a 34% better compression factor and 60% higher compression speed for FSST relative to LZ4 in file mode. The faster decoder varies by column, and their mean decompression speeds are almost identical.

The paper also considers reordering the file input. Fully sorting the lines of dbtext lexicographically raises LZ4's compression factor to 2.07×. Sorting puts more similar lines next to each other. FSST's table gives repeated substrings a shared representation wherever they occur in the group, so the same local clustering has less influence on its result. This comparison helps establish what the file-mode result measures. It depends in part on how the data are arranged for a compressor that exploits nearby material.

For the rest of the string experiments, the authors use line mode, in which each line is a separate string and the newline is absent from its contents. The reported FSST factor falls to 2.19×. The authors point out the change in input representation as well as the shorter units. The file-mode and line-mode factors therefore describe related but distinct settings, and an application that requires independent values should use the latter as the closer point of comparison.

Small values and selective reads

The paper isolates the effect of block size with LZ4 on the urls column. With blocks of 64K bytes, it reports a compression factor of 2.73. The factor is 2.03 at 4K bytes and 1.59 at 1K bytes. At 256 bytes it has fallen to 1.14, while at 64 bytes it is 0.78. At 16 bytes the reported factor is 0.46. Values below unity indicate that the compressed representation occupies more space than the input. This experiment changes the size of the group available to the same compressor, showing how quickly its useful redundancy diminishes as the unit approaches a typical short string.

The string-by-string comparison adds two further ways of using LZ4. In one, a dictionary generated with zstd is supplied while compressing individual lines. It gives the codec information from outside the current string. The paper reports some improvement in compression relative to plain line-by-line LZ4 and a severe cost in compression speed. The other alternative groups 1,000 values into a block. That gives LZ4 repeated text to exploit within each block, and the stored values are then accessed through block decompression. FSST is reported to give better compression factors and faster encoding than all the LZ4 variants in this comparison. Its decompression throughput is comparable to the fastest of them.

The selective retrieval experiment examines the work those formats require when only part of the relation is wanted. With FSST, the output rate stays steady as the selected fraction changes in the experiment, since decoding can be restricted to the chosen values. The LZ4 block variant has to expand unrequested values in blocks that it reads. As a consequence, its useful output rate suffers when fewer of the values it decodes contribute to the result. This experiment connects the format's independence guarantee to an observable access pattern. The comparison is about the rate of delivering the requested values, not just how quickly a decoder can expand a contiguous stream.

Encoding costs and the workload outside dbtext

The kernel measurements separate the cost of encoding strings from the cost of preparing the table. The paper's comparison of unrolling settings gives the following average costs across dbtext. A lower count indicates less processor work per input byte on the benchmark machine.

Average FSST encoding cost across dbtext by kernel

The vector kernel with three-way unrolling has the lowest average cost.

Average FSST encoding cost across dbtext by kernelScalar: 10.38Scalar10.38SIMD, one group: 7.42SIMD, one group7.42SIMD, two groups: 4.76SIMD, two groups4.76SIMD, three groups (this paper): 4.08SIMD, three groups (this paper)4.08SIMD, four groups: 4.31SIMD, four groups4.31
The numbers
System or settingcycles per input byte
Scalar10.38
SIMD, one group7.42
SIMD, two groups4.76
SIMD, three groups (this paper)4.08
SIMD, four groups4.31

The strongest vector setting is reported as 2.5× faster than scalar encoding. The paper also characterizes the optimized kernel at about 4.1 cycles per byte and 920MB/s on the i9-7900X. In its overall account of FSST on textual data, the paper gives approximately 4 cycles per byte for AVX512 encoding and 2 cycles per byte for decoding, corresponding to 1 GB/s and 2 GB/s on that platform. These are bulk rates. The cost of fetching a particular string inside a database can also depend on locating it and getting the table into memory.

The authors use Silesia to examine inputs beyond the target string columns. On its text files the paper reports 10% better compression sizes for FSST relative to LZ4. On the binary files FSST is 25% worse on average. The paper separately describes a disadvantage on large XML and JSON files, with FSST's compression ratio reported as 2-2.5x worse than LZ4's. These results establish a boundary for the text-column findings. A byte sequence that happens to contain text can still have a repetition structure poorly matched to a small flat symbol table.

Query execution in Umbra

The authors built two compression integrations in Umbra. FSST compresses individual strings and permits the engine to defer decompression until a query operation needs it. Equality predicates against constants can run on encoded values using the matching table. Operations such as sorting, comparisons other than equality, and printing results require access to the expanded values in the prototype. The LZ4 integration compresses the strings of a column in a block of tuples and decodes the block when needed. It can first evaluate predicates on other columns, then skip string decompression for a block when no tuples qualify.

The tests run TPC-H SF10 with 20 threads. Much of the benchmark executes joins on integer columns, so most runtimes move little when the engine changes the representation of its strings. The geometric mean of the query times is 57 ms with strings uncompressed, 59 ms with LZ4, and 53 ms with FSST. The geometric mean summarizes relative performance across queries of different durations. It leaves visible in the individual query results where the changes to string access do the most work.

Q19 execution time on Umbra TPC-H SF10

FSST has the shortest runtime on the query that makes heavy use of compressible strings.

Q19 execution time on Umbra TPC-H SF10Uncompressed: 99Uncompressed99LZ4: 91LZ491FSST (this paper): 69FSST (this paper)69
The numbers
System or settingms
Uncompressed99
LZ491
FSST (this paper)69

The authors attribute the Q19 result to reduced scan memory bandwidth and to the ability to apply string filters directly to compressed values. Q13 gives a different view because a LIKE predicate on the comment field drives much of its work. Its uncompressed runtime is 228 ms, against 235 ms for FSST and 250 ms for LZ4. The authors report a slowdown of 3% for FSST and 9% for LZ4 on that query. The predicate is evaluated on decoded contents in the prototype, so it exposes decompression work that the equality case can avoid.

Umbra's string pool occupies 4.1GB with uncompressed strings, 1.5GB with LZ4, and 0.69GB with FSST. Those figures concern the separately allocated pool. Umbra can inline strings of 12 bytes or less, storing them directly inside their fixed-size representation. Compression moves many TPC-H strings under that threshold, so they no longer need an allocation in the pool. The pool result therefore reflects both smaller encoded values and a change in where the engine stores them.

A further experiment makes a join depend on string keys. The authors pad the keys with a common prefix to keep them long enough to exceed the layout's short-string threshold. The query counts matching orders and line items. It takes 484ms uncompressed, 560ms with LZ4, and 554ms with FSST. The joined columns use different tables, so the engine decodes their strings for comparison. Profiling indicates that most of the added work arises when Umbra copies the temporary decoded values into its hash table. The uncompressed values were already available in stable storage. FSST decoding itself accounts for 9% of the time in this experiment. The authors report an overhead of 14% for FSST in this deliberately padded case.

What the ablations show

Better table construction can improve both size and speed

The paper traces the compressor through several variants. Some adjacent variants isolate a particular choice, while others replace a group of related mechanisms. The measurements include compression factor, symbol-table construction cost per byte for a new table every 8MB, and the cost of encoding the strings. These separate columns in the evaluation are important. Faster table construction may hardly change an encoding kernel's cost, while a faster kernel says little about whether the chosen table gives good compression.

The earliest suffix-array approach finds frequently repeated substrings and attempts to account for dependencies as it picks entries. A suffix array organizes suffixes of the source so that shared byte sequences can be found efficiently. That helps identify promising candidates by frequency. The harder step is estimating the new contribution of a sequence given the decisions already made. The authors found that correcting for previous selections gave poor estimates and ultimately weaker tables than testing symbols in an actual trial encoding.

The comparison between the greedy suffix-array variant and the first bottom-up FSST variant provides evidence for the effect of changing the builder. Both use greedy matching over a sorted arrangement and compare symbols as machine words. The compression factor rises from 1.95 to 2.33. Table construction cost falls from 74.0 to 2.1 cycles per byte, and encoding cost falls from 37.4 to 20.0 cycles per byte. This comparison supports counting what the current encoder does as a practical way to pick entries. It does not need the resulting table to be optimal to show that it works better than the suffix-array builder in the comparison.

The small worked example shows the mechanism at the level of an individual symbol. A short sequence has a promising count and enters a generation containing a longer sequence. The longer match consumes the short one's opportunities. When the builder counts what was emitted, the apparently valuable short entry can lose its place. The corpus comparison measures the combined result of many such decisions. The example supplies a concrete account of what the measured builder is doing differently.

The greedy encoder trades little space for less work

The early variants also compare dynamic programming with greedy matching. With machine-word comparisons and suffix-array construction, the dynamic-programming variant has a compression factor of 1.97 and an encoding cost of 81.7 cycles per byte. The greedy variant has a factor of 1.95 and an encoding cost of 37.4 cycles per byte. The more expensive search improves the representation only slightly in this comparison. It also has to consider future positions, whereas the greedy encoder commits to a match and moves forward immediately.

Another early change keeps dynamic programming and replaces the string comparison procedure with word comparisons. Encoding cost drops from 160.0 to 81.7 cycles per byte, with a compression factor of 1.97 in both variants. This is evidence about the cost of matching a candidate, independently of which partition of the string the algorithm chooses. It helps explain why the symbol length bound matters to the performance design. When a symbol fits into a machine word, much of the string operation can be expressed as a word comparison.

The move from the sorted bottom-up table to lossy hashing changes both which entries the builder can retain and how the encoder finds a match. Encoding cost goes from 20.0 to 10.3 cycles per byte, and the compression factor goes from 2.33 to 2.28. Since the transition changes table organization and introduces predicated encoding together, this comparison supports the package as a whole. It does not isolate the space cost due to shared prefixes from the cost due to collisions between different hash keys. Nor does it assign the full speed gain to any single instruction.

Faster training and wider execution affect different costs

The next revision combines fewer rounds, a growing sample, and a smaller footprint for the counters used in construction. The earlier builder used 10 iterations and the optimized one uses 5. In the variant comparison, table construction cost goes from 1.73 to 0.83 cycles per byte, while encoding remains at 10.3 cycles per byte. The compression factor changes from 2.28 to 2.19. These figures give a measured tradeoff for the combined construction changes. They do not determine how much each of sampling, iteration count, and the counter layout contributes individually.

The final variant replaces scalar encoding with the AVX512 kernel. The table construction cost stays at 0.83 cycles per byte and the compression factor stays at 2.19, while the encoding cost drops to 4.1 cycles per byte. This is a cleaner separation of the vector kernel's contribution. Faster emission comes from feeding the same format through a different execution path, with segment boundaries shared by the scalar encoder to preserve the same encoding decisions.

The unrolling experiment then compares several ways to schedule that vector path. Going from one group to more overlapping groups reduces the average work per input byte on the benchmark machine up to the best three-way setting. Four groups give a higher average cost again. The paper explains that more overlapping work can hide gather latency, while a wider kernel needs more registers. Its job packing was motivated by fitting the 3× unrolled design without losing performance to register spilling. The measurements identify the best setting tested on this processor. They leave open which setting would work best under a different balance of instruction latency and register use.

The access experiments reveal a different kind of tradeoff. Shortening LZ4 blocks changes the information available to the compressor. Grouping values restores some of its ability to compress but also increases the unit of later decoding. FSST's shared table retains cross-value information while leaving the decoding unit at the individual value. These measurements explain why the paper includes both bulk and selective experiments. A good mass-decompression rate and a good rate of retrieving selected values describe different work, and the latter depends on which bytes the format obliges the system to expand.

Limitations

Limits the authors state

FSST targets strings like those in database columns. The authors explicitly report poorer results on binary files and on large XML and JSON documents. They propose representing structured documents through their fields when the database can do so, citing Snowflake's organization of frequently occurring JSON attributes as an example. Storing attributes separately can remove repeated field names and expose string values in columns of their own. That is a suggestion about the format of the input to FSST. The experiments on large documents report the outcome when those documents themselves are compressed.

Compressed equality in the paper has a clear scope. Its operands must share a symbol table and the associated encoding rules. Column values represented with different tables can have different compressed bytes for the same original text. The padded-key join encounters just this situation and expands the values. A system using separate tables for finer groups needs to track the appropriate table for each group. It may need to encode a predicate constant for a particular table before comparing the bytes. The potential gain from fitting a small group more closely therefore comes with bookkeeping for the readers of that group.

The authors leave direct matching for more complex operations to future work. They discuss transforming a byte-stream recognizer to operate on a stream of symbol codes and suggest investigating a substring search in the style of Knuth–Morris–Pratt. With a substring predicate, a match can begin inside a decoded symbol or continue across several of them. Such a search would have to account for those positions, in addition to reading the codes correctly. The paper's implemented query optimization covers equality, and its LIKE result uses decompression. The authors also note that a compressed-domain operation has a demanding performance target because the alternative already has a fast decoder and fewer compressed bytes to read.

The authors qualify the Umbra results in two ways. TPC-H offers few selective predicates, which limits how much of FSST's random-access advantage the end-to-end test can expose. And the large reduction in the string pool is helped by inlining after compression. A database with a different string layout, or a column whose compressed values rarely cross the same size threshold, can show a smaller space difference. The paper also leaves a hardware implementation of the decoder as future work. Its suggestion rests on the compact table and simple expansion rules, with the reported speeds coming from software.

What the experimental setup leaves open

The best throughput figures depend on the benchmark platform and the availability of enough concurrent encoding jobs. The three-way AVX512 result comes from the particular i9-7900X used in the experiments. Scalar encoding has its own measured cost and is used when AVX512 is unavailable or a string is very short. Batch composition matters because the vector loop benefits from a queue of segments to refill retired lanes. The measurements support a speed advantage in the reported setting, while the throughput for isolated short values or for different processors remains a separate question.

Construction is heuristic and fit to the sample. Ranking apparent gains and rejecting collisions keep the encoder practical, but the search tests only a small subset of possible tables. The results show that this search finds effective tables in the measured corpus. They do not establish how close those tables are to the best attainable compression under the format. A shift in strings after training can also reduce the value of stored symbols. Escapes keep the encoding correct in that situation. The amount of compression depends on whether the new strings repeat sequences the table already represents. The paper does not quantify that effect over changing workloads.

The experiment on selective retrieval and the prototype query benchmark establish different kinds of evidence. Selective retrieval demonstrates independence from the decoding of neighboring rows. Umbra demonstrates the result of incorporating that property into one engine with its own layout, predicate handling, and memory ownership rules. The padded-key join shows how those details can dominate an overhead attributed broadly to compression. The need to copy freshly expanded strings is a property of how that prototype stores values in the join's hash table. An engine with different ownership or allocation behavior would need its own measurement.

Finally, the codec preserves access to individual strings given a storage structure that locates their compressed representations. Its table resolves codes once decoding has begun. The experiments do not establish the cost of locating arbitrary byte positions inside a string without expanding preceding symbols, and the format's random-access claim concerns values as units. That scope fits the database use cases in the paper, where a row, dictionary entry, or index lookup identifies the value the operator needs.

What came after

No subsequent study is covered here. The compressed substring search and hardware decoder are research directions proposed by the authors, with outcomes left open.

Cite

Cite as Peter A. Boncz, Thomas Neumann and Viktor Leis. 2020. FSST. Proceedings of the VLDB Endowment.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.14778/3407790.3407851

@inproceedings{boncz2020fsst,
  title = {{FSST}},
  author = {Peter A. Boncz, Thomas Neumann and Viktor Leis},
  booktitle = {Proceedings of the VLDB Endowment},
  year = {2020},
  doi = {10.14778/3407790.3407851},
  url = {https://doi.org/10.14778/3407790.3407851}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/boncz-2020-fsst/