Manuscript Offprint
arXiv:2610.40620Tessera: Fast Join-Aggregates over Skewed Sparse Relations in Database Engines
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Join-aggregate queries count or sum matching rows for each pair of values, often over skewed sparse relations in which a few values are frequent and most pairs of values never co-occur. Conventional execution plans materialize billions of intermediate join rows, taking minutes to tens of minutes per query. Recent matrix-based solutions reformulate these queries as matrix multiplication to reduce or avoid this materialization. However, they remain slow because they either store result cells for non-matching pairs or still materialize intermediate join rows for infrequent values. We present Tessera, a skew-aware join-aggregate operator for database engines that avoids both sources of overhead. Specifically, Tessera computes a sparse matrix product directly over the engine's rows, emits only nonzero cells as result rows, and prunes values that cannot meet the query's threshold before multiplication begins. It also offloads the dense block formed by pairs of the most frequent values to a CPU matrix accelerator when that block is dense enough. Experimental results show that Tessera is faster than the fastest existing system by to . In addition, Tessera outperforms DuckDB's execution plans by up to .
Artifact Availability:
The source code is available at https://github.com/GyuyeongKim/Tessera-public.
1 INTRODUCTION
Many analytics questions ask how often two things occur together. For example, an analyst asks which words appear in the same documents, which movies the same users rate, which products the same customers buy, or how many friends two users share. In SQL, this is a join-aggregate query. It joins a relation with itself, or with a second relation, on a shared key, and then groups the joined rows by one attribute from each side to count or sum them. Many of these queries retain only strong pairs whose counts meet a threshold, such as words that co-occur in at least 100 documents, or rank among the top k. Join-aggregates appear in decision-support benchmarks [47, 50] and are used to build set similarity joins and item-to-item recommendation [39, 45]. In these use cases, the execution time of a join-aggregate matters. This is because an analyst waits for each answer before asking the next question, and a recommender recomputes its item similarities every time it retrains on new data.
The relations behind these questions are skewed and sparse. Value frequencies are heavy-tailed [15], with a few values, such as common words or popular movies, in many rows and most values in few. Most pairs of values also never co-occur, since no key holds both of them. We call them non-matching pairs. For example, in a collection of 300K news articles [43], 89% of the pairs of words never appear in the same article. However, current database engines perform join-aggregates slowly on such relations. For example, counting word co-occurrence over the news articles produces 20 billion joined rows, and an analytical engine such as DuckDB [44] builds and aggregates every one of them.
Prior work reduces or avoids intermediate join rows by computing a join-aggregate as a matrix product and accelerates queries by speeding up multiplication [19, 28, 29, 35]. However, these designs remain inefficient on skewed sparse relations. Specifically, join-project algorithms [19, 28] multiply frequent values as a dense matrix but still materialize join rows for rare values. Meanwhile, in-database linear algebra [35] and tensor-core databases [29] keep dense results with cells for non-matching pairs. These costs limit the benefit of faster multiplication, even with recent on-CPU matrix accelerators (e.g., Intel AMX [34]). In this context, we ask: how can a database engine speed up the whole join-aggregate on skewed sparse relations?
To answer this question affirmatively, we present Tessera, a high-performance skew-aware join-aggregate operator for database engines. Our key insight is that skew packs repeated computation into a small dense core of frequent values, while the long tail of rare values accounts for most result cells. Therefore, accelerating the core pays off only when processing the long tail and writing the results are also cheap. Based on this insight, Tessera splits the values at a dense frontier, which separates the dense core of frequent values from the long tail. Inside the frontier, a matrix accelerator multiplies the pairs of frequent values as dense tiles. Beyond it, a sparse path computes only the nonzero result cells of rarer values and does most of the work. Tessera chooses the frontier for each query by comparing the cost of each accelerator tile with that of the sparse products it replaces.
Realizing this design raises four technical challenges. First, the rare values and the output carry most of the work, and the result may not fit in the engine's memory budget. Furthermore, a query that keeps only the pairs whose counts meet a threshold usually does as much work as one that keeps all pairs, since the threshold applies only after each cell is computed. Second, the best frontier depends on the relation and on the query, because the accelerator pays for whole tiles and pruning changes which values remain. Third, the matrix accelerator multiplies dense tiles, but even the dense core is mostly zeros, and a dense copy of it grows with the number of rows. Lastly, the operator must run inside engines that differ in how they plan queries and manage resources.
Tessera addresses these challenges with the following mechanisms. First, the sparse path runs Gustavson's sparse product algorithm [26] on the engine's rows and adds products into counters instead of building joined rows ( ). It writes only the nonzero cells, which spill to files when they exceed the engine’s memory limit. Before any product, it drops the values that cannot reach the threshold, and a stricter query therefore runs faster. Second, a cost model scans the rows once, and Tessera picks the frontier with the lowest predicted runtime after pruning ( ). If no block is dense enough, the accelerator costs only this scan. Third, Tessera groups rows that share frequent values and skips tiles without useful products ( ). As a result, the accelerator’s work follows its nonzero tiles rather than the size of the core. Lastly, each engine reaches Tessera through a C interface and a small adapter built on its extension hooks for plans, scans, and typed output ( ).
Tessera is readily deployable. We integrate Tessera into four database engines as extensions, DuckDB, PostgreSQL [49], SQLite [23], and Spark [7]. In DuckDB, PostgreSQL, and Spark, the adapter rewrites the plan of a join-aggregate, whose query therefore needs no change. Users can install Tessera through each engine's own package channel. We conduct a series of experiments and find that Tessera outperforms the fastest existing system by to . In all four engines, Tessera is faster than their own plans, especially by up to in DuckDB.
In summary, this work makes the following contributions:
-
We show that on skewed sparse relations, a faster multiplication, even on a matrix accelerator, gains little, since existing matrix-based designs still spend their work on non-matching pairs and on the rows of rare values.
-
We design Tessera, a skew-aware operator that runs a sparse product on the engine’s rows and returns rows, prunes values before the product, and gives a matrix accelerator the dense core that a cost model sizes for each query.
-
We implement Tessera in four database engines and show that it outperforms both existing matrix-based systems and the engines' own plans.
2.1 Join-Aggregates
The query. A join-aggregate over a relation joins R with itself on the key k and counts the joined rows for each pair of values of x:
In a word co-occurrence query, k is a document and x is a word. In item-to-item recommendation, k is a user and x is an item, and in common-neighbor counting, k and x are both vertices of a graph.
Variants of the query sum a product of two weights, SUM(a.v * b.v), keep one row per unordered pair with a.x < b.x, or keep only the strong pairs with HAVING or ORDER BY ... LIMIT. Frequent pair mining is the last form with a support threshold [3, 25]. A two-relation product joins with a second relation and groups by x and y, such as movies and the tags that their viewers use. Item similarity divides the count of a pair by the sizes of the two items, as in cosine or Jaccard similarity, and keeps the pairs above a threshold [8, 39].
Why it is expensive. A database engine runs the query as a hash join followed by a hash aggregation, making every joined row a hash-table update (Figure 1 (a)). The join emits rows for a key that

(a) Hash join and aggregation, one hash-table update per joined row

(b) Matrix product, no joined rows but a dense result
Figure 1: Two ways to compute a join-aggregate, which waste work on (a) joined rows or (b) zero result cells.
occurs in rows. The engine processes joined rows, a sum that the few long keys of skewed data dominate. For example, the 300K articles of a news collection hold 70 million distinct document-word pairs but produce 20 billion joined rows, almost all of them from long documents and common words. Thresholds do not help, since the engine filters the groups only after it aggregates every joined row. Pushing the aggregation below the join [55] does not remove these rows either, since each side must keep both its key and its value and can merge only repeated rows.
The matrix view. Computing a join-aggregate as a matrix product removes the joined rows, but on real relations most cells of the result are zero. Let X be the matrix with one row per key and one column per value, where is the number of rows , or the weight v. The count of the pair is then . Hence, , and a two-relation product is . As Figure 1 (b) shows, the product reads each row of X once and adds its products into C instead of building joined rows. However, both X and C are sparse. Existing matrix-based designs nonetheless focus on how fast this product runs.
2.2 Matrix-Based Designs
Existing matrix-based designs. Designs that compute a join-aggregate as a matrix product differ mainly in how they multiply, and each leaves the rare values or the result on a slower path. Join-project algorithms split the values by frequency and run the frequent part as a dense matrix product [19, 28]. However, they still join the rare values and build their joined rows. In-database linear algebra such as SPALM [35] picks a sparse or a dense kernel for each block inside DuckDB [44], and its DuckDB operator writes a dense result of all pairs. Tensor-core databases such as TCUDB [29] run dense products on GPUs and fall back to a hash join or a sparse kernel on sparse inputs. Sparse matrix libraries such as GraphBLAS [16], which some engines embed [14], handle sparse operands well. However, they work on matrices in their own
Hash join and aggregation
Dense product
Dense product at peak

(a) News articles
(b) Medical abstracts
Figure 2: Offloading only the frequent values to AMX, even at its peak speed, leaves much of the time to the rare values. The rest runs in DuckDB 1.5.6 with a. x < b. x, and AMX peak charges the dense part at the peak rate of tile products whose operands stay in the tile registers.
Table 1: Comparison to existing systems.
| Dense unit | No joined rows | No zero result cells | Threshold saves work | Runs in engine | |
|---|---|---|---|---|---|
| DuckDB, PostgreSQL [44, 49] | None | ✕ | ✓ | ✕ | ✓ |
| MMJoin [9, 19] | Vector | ✕ | ✓ | ✓ | ✕ |
| SPALM [35] | Vector | ✓ | ✕ | ✕ | ✓ |
| TCUDB [29] | GPU | ✓ | ✕ | ✕ | ✓ |
| GraphBLAS [14, 16] | None | ✓ | ✓ | ✕ | ✓ |
| Tessera | Matrix acc. | ✓ | ✓ | ✓ | ✓ |
format and assemble the result as a matrix. SPALM, TCUDB, and GraphBLAS also filter by a threshold only after the full product. Faster multiplication gains little. A faster multiplication speeds up matrix-based designs only a little, because the rare values and the result keep a large share of their time. For example, on the block of the 8,192 most frequent news words, SPALM spends only 0.67 of its 2.75 seconds of kernel time in kernels with a dense operand. Therefore, faster dense kernels speed up the block by at most . MMJoin [9], a standalone implementation of the frequency split, spends only of its time in its dense product at eight of nine support thresholds. We also measure a natural design that runs the frequent block of this split on Intel AMX [34], which multiplies small dense matrices in a single CPU instruction. It uses a vendor library for this block and leaves the rest to the engine. Figure 2 shows that with a. x < b. x, the rest still takes and of the time at the best split even if the dense part ran at the peak speed of AMX. As a result, a matrix accelerator pays off only when the rare values and the result are also cheap.
2.3 Our Approach
Tessera follows the skew of the data. A sparse path handles the rare values and the output, and a CPU matrix accelerator handles the dense core. The two meet at a frontier that a cost model sets for each query. Table 1 shows that every existing system misses at least one of these properties, and none of them runs a CPU matrix accelerator.
The sparse path. The sparse path is the main path of Tessera, since the rare values produce most of the cells of the result. Any design must compute their products and write their cells, and Tessera makes each of these steps cheap. For example, to count the words that appear with one word, Tessera walks the articles that contain it and adds to a counter for each other word in them. It builds no joined row and probes no hash table. Only the counters that a value touched become result rows, which go unsorted into per-thread chunks. A sparse matrix library computes the same counts [16, 26], but Tessera emits the cells as rows instead of a matrix. Hence, its cost follows the products and the nonzero cells, never all pairs of values or a dense result.

Vector units
Matrix accelerator
With a threshold
No dense core
Figure 3: Tessera sets the dense frontier per query and gives the accelerator only the frequent values whose tiles pay off. Values are in frequency order.
Pruning before the product. Two words cannot share more articles than either of them appears in, and with weights or repeated rows, this bound is multiplied by the largest entry of X. Therefore, with a threshold, Tessera drops the values that cannot reach it before any product. For a top-k query, a first pass over the most frequent values yields such a threshold. As a result, a stricter query runs faster.
The dense core on a matrix accelerator. A matrix accelerator, such as Intel AMX [34], Arm SME [6], or the matrix facility of IBM Power10 [41], is a unit of a CPU that multiplies small matrices, called tiles, in one instruction. It works on the CPU's own caches and memory and multiplies several times faster than the vector units. However, it always multiplies whole tiles, and a zero in a tile costs as much as a useful product. Therefore, a block of the result pays off on the accelerator only once its density, its share of useful products, exceeds a break-even density . is the accelerator's time per multiply-add divided by the time of one sparse product. Skew forms blocks above this density once the values are ordered by frequency. For example, the block of the 4,096 most frequent news words holds of all joined rows and lies above , unlike that of the medical abstracts. Hence, whether a core pays off depends on the relation.
Where the two parts meet. How Tessera divides the pairs of values between the two parts decides how much the accelerator saves. Since the blocks above gather among the most frequent values, Tessera divides them at one point of the frequency order, the dense frontier, which is the number of most frequent values whose pairs run on the accelerator. A frontier that is too small leaves dense blocks to the sparse path, and one that is too large gives the accelerator tiles that hold mostly zeros. Moreover, the best frontier moves, as Figure 3 shows. Since a faster accelerator lowers and a cheaper sparse path raises it, the first moves the frontier outward and the second moves it inward. Pruning moves it too, since it removes values first. Therefore, a cost model places the frontier for each query where a tile costs as much as the sparse products it replaces.

Figure 4: Workflow of Tessera inside a database engine. ① The adapter hands the input rows to Tessera once. ② Tessera ranks the values by frequency and stores each key's values in rank order. ③ A threshold removes the values that cannot reach it. ④ A cost model sets the frontier H. ⑤ The matrix accelerator multiplies the dense core, and the sparse path computes the other pairs. ⑥ The cells return to the engine as result rows.
Why it works. The sparse path builds no joined rows, but it still performs one product for each pair of values in a key, about half as many products as the engine has joined rows. Its gain is therefore a constant factor per product, since an addition into a counter replaces a joined row and a hash-table update, and it writes only the nonzero cells. The accelerator runs only where its tiles cost less than the sparse products they replace. When no block is dense enough, Tessera runs only the sparse path, after the model's pass over the rows. Pruning drops a value only when none of its cells can reach the threshold, which keeps the result exact.
3 DESIGN
3.1 Overview
Tessera is a single operator that a database engine calls in place of its join and aggregation. It takes the rows of the input, or with a weight, and returns the nonzero cells of as rows of the result. Figure 4 shows its workflow.
① Collection. The engine’s adapter recognizes the join-aggregate in the query plan and streams the input rows to Tessera once. Tessera codes the keys as dense integers and merges repeated rows into one entry whose value is their count, or the sum of their weights.
② Ranking. Tessera numbers the values x by frequency, the most frequent first, and stores X by key, with each row's values in rank order. After this step, the block of the first H ranks is the densest block of C. Hence, one number H splits the work, and pruning becomes a cut of the rank order.
③ Pruning. For a query with HAVING or ORDER BY ... LIMIT, Tessera drops the values whose cells cannot pass the threshold.
④ Frontier. A cost model picks the frontier H for this query.
⑤ Products. The grid computes the pairs of values whose ranks are both below H on the matrix accelerator. The sparse path computes the pairs of two rarer values. The pairs of a frontier value and a rarer value run on the sparse path for sums and, for counts, on the matrix accelerator through the heavy-light path. Both compute each unordered pair once.
Values ordered by rank

Accumulator of column j, indexed by i. Its touched entries are the result cells.
Figure 5: Example of the symmetric sparse path and item pruning. Each row is scanned up to the column value j, and values beyond the pruning prefix never enter the product.
⑥ Output. The cells go to per-thread output chunks. The adapter maps the ranks back to the original values and emits the rows in the engine's types, with both orders of each pair or one order for a. x < b. x.
Supported queries. Tessera runs three forms of join-aggregate. The first is the self-join aggregate SELECT a.x, b.x, f FROM R a JOIN R b ON a.k = b.k GROUP BY a.x, b.x, where f is COUNT() or SUM(a.v * b.v). It may add a pair filter a.x < b.x (or ≤, >, ≥), HAVING f >= c, or ORDER BY f DESC LIMIT k. The second is COUNT() or SUM(a.v * b.w) over two relations and joined on k and grouped by a.x and b.y. The third is item similarity above a threshold, with the cosine, Jaccard, Dice, or overlap measure, which Tessera offers as a function in every engine. In all three, R and S are tables or views of one table, keys and values are 64-bit integers or strings without NULLs, and weights are numbers. For any other query, the adapter leaves the plan unchanged, and the engine runs it with its own join and aggregation. Examples are a.x <> b.x, a third relation, a further grouping column or aggregate, and row-level security.
3.2 The Sparse Path and the Output
The sparse path must compute every pair that involves a rare value and write every nonzero cell of the result. On skewed relations, these pairs and the output, which can hold billions of cells, take most of the time. Therefore, the cost of each product and each cell decides the time of the query. A straightforward approach hands X to a sparse matrix library and converts the resulting matrix back into rows. However, the library does more work than the query needs. It builds C as a sorted matrix, and it often computes both halves of the symmetric product and adds the products through hash tables. It also applies a threshold only after it has computed every cell. The principle of Tessera is to compute only what a relational result needs. A relational result needs only one half of the product, and it accepts its cells as unordered rows. Moreover, only the values that can pass the threshold contribute to it. Hence, the sparse path scans the rank-ordered rows once per column, removes values before any product, and appends its cells to per-thread chunks.
Symmetric sparse path. The sparse path computes one column of C at a time with Gustavson's algorithm, and the threads take columns in parallel. For each row that holds j, it adds for the row's values into an array indexed by the rank i. In the word example, each article that contains word j adds to the counters of its more frequent words. Since each row is in rank order, the scan stops at j, and each unordered pair is computed once. For counts, the scan also skips the frontier values, whose pairs with j run on the heavy-light path. After the last row, the touched entries are the cells of column j, and Tessera emits them as rows and resets only those entries.
Item pruning. Instead of filtering the cells after the product, Tessera bounds each value. For counts and integer weights, is at most the total of in value 's column, the frequency of for counts, times the largest entry of . Tessera takes the maximum of these bounds over each suffix of the ranks. As a result, the values that can reach the threshold form a prefix. Since the bounds mostly fall with the frequency rank, a high threshold leaves a short prefix. Cutting the rest removes values before any product and before the frontier is chosen. As a result, a stricter query runs a smaller problem, and the engine's own filter above the operator keeps the result exact. For ORDER BY ... LIMIT k, the threshold is the unknown k-th largest cell. A first run on the 256 most frequent values, where the bounds are largest, yields a lower bound on it. A second run then adds only the cells of the other values that can reach this bound.
Output chunks. The output can exceed the memory that the engine allows. A shared result buffer would make the threads contend for it, and per-thread results merged at the end would copy every cell again. Instead, each thread appends its cells to its own chunks of cells, fewer under a small memory limit, and these chunks are the result. When the output exceeds the engine's memory limit, each thread appends its chunks to its own temporary file, since one shared file would serialize the threads, and maps them back for reading.
An example of the sparse path. In Figure 5, value j occurs in rows and . Row adds its products with and , and row with and . As a result, column j ends with three cells, one of them with a count of 2.
3.3 Choosing the Dense Frontier
Tessera must decide for each query how many of the most frequent values run on the matrix accelerator. The choice is hard for three reasons. First, the accelerator pays per tile, and how many tiles hold a nonzero depends on how the rows are grouped, not only on the density of a block. Second, the frontier carries a setup cost, since Tessera must order the rows that it covers and build their tiles. Third, the same table needs different frontiers for different thresholds, because pruning changes the values that remain. Therefore, a fixed rule, such as a number of values or a density threshold per block, would suit some relations and queries and miss on others. We address this challenge by estimating the time of every candidate frontier from the rows themselves, cheaply enough to do so before each query. Specifically, a cost model evaluates all candidates in one pass over the rows and picks the cheapest.
Frontier cost model. Running every candidate would cost more than the query itself. Instead, Tessera estimates the runtime of each candidate frontier as a sum of four terms, one for each kind of work. The candidates double from 512 up to 65,536 values, or up to all values if a relation has fewer. A smaller frontier moves too few products to the accelerator to pay for its setup, and at 65,536 values the grid's buffers for tile results already take 2 GB. The tile term counts the tile products that hold a

Figure 6: Example of the estimated time of candidate frontiers for a text collection. Above 1K values, the tile term grows slowly while the sparse term falls, until the frontier reaches rare values.
useful product. Counting them exactly would require building the tiles, which is the very setup that the estimate must avoid. Hence, Tessera counts them on a sample of a few thousand groups of consecutive rows. The block term charges each pair of value blocks for its bookkeeping and its results, and the setup term charges each row and each nonzero that the frontier covers. The sparse term counts exactly the products that involve a value beyond H, which follow from the number of frontier values and other values in each row, and for counts it also charges the heavy-light path. One pass over the rows evaluates all candidates together, because each row's values are in rank order and each candidate is one position in the row. The model has seven constants, one for each kind of work, which we measure once per machine from a few runs with forced frontiers.
An example of the frontier choice. Figure 6 shows the estimate for a text collection. As H grows, the frequent words move to the grid, and the sparse term falls faster than the tile term grows, since their tiles are full. Beyond the best frontier, the new values are rare, and their tiles add tile products and setup but remove few sparse products. Tessera picks the minimum, and for a pruned query it recomputes the curve on the remaining values.
3.4 Feeding the Matrix Accelerator from Sparse Rows
The matrix accelerator multiplies dense tiles, but even in the frontier, a row holds few of the H values, and most entries of the dense core are zero. A strawman approach would copy the frontier into a dense matrix with one row per key and call a vendor library. However, the copy would grow with the input rather than with the result, and the library would also multiply the tiles that hold only zeros. Compressing away the empty columns of each pair of blocks would avoid these tiles, but building and mapping back the compressed operands of every pair would cost as much as it saves. Our approach is to build each tile directly from the rows that touch it and to skip every tile in which no row holds a value of both blocks.
Panels built from rows. The accelerator holds only a few tiles at a time, and it multiplies two tiles that it loads from memory into a third that it keeps. Hence, Tessera cuts the dense core into pieces of tile size. It splits the frontier into blocks of values, as wide as the results of a pair of blocks can be while they stay inside the accelerator with the tiles being multiplied, and the rows into chunks of consecutive rows. For each block and chunk that share a nonzero, Tessera writes a panel, the chunk's entries for the block at one byte
① Find common chunks
② Multiply halves with values

Figure 7: Example of the grid for one pair of 32-value blocks and over four chunks of 64 rows. ① A bitmap per block marks the chunks that hold its values, and only the chunks common to both are loaded. ② In each common chunk, only the halves of the two panels that hold values are multiplied.
each, and marks which halves of the block hold values. A bitmap per block marks the chunks that have a panel. Since a panel holds one byte per value, the grid runs counts and weights from 1 to 255. Larger integer weights run on the sparse path with exact integer sums, and real weights on one with floating-point sums and without pruning.
Row order. Rows that hold the same values should share a chunk, since their values then fill a few panels instead of many. Finding the best order is a hard clustering problem. Instead, Tessera sorts the rows by two MinHash signatures of their frontier values [13], which two rows share with a probability equal to the share of values they have in common.
The pair loop. For a pair of blocks with , the counts stay inside the accelerator as four result tiles, one for each pair of block halves, and Figure 7 shows the two steps that fill them. First, Tessera intersects the chunk bitmaps of the two blocks and reads only the chunks that hold values of both, chunks 1 and 3 in the example (1). Second, in each common chunk, it multiplies only the panel halves that hold values (2). As a result, chunk 1 needs one tile product instead of four, and chunk 3 needs two. Since the result tiles hold 32-bit sums, Tessera checks from the column totals of the frontier that no cell can reach and otherwise runs the query without a frontier.
Grouped pair loop. Each block takes part in many pairs, and the order of the pairs decides how often its panels come from memory. Tessera therefore orders the pairs to reuse panels while they are still in the caches, as a blocked matrix multiplication does. It takes a group of second blocks and a range of chunks whose panels fit in the CPU's last-level cache. Within a range, each thread multiplies a few first blocks at a time with every block of the group, which keeps their panels in the core's second-level cache. Between ranges, the result tiles of a pair wait in memory, and Tessera merges consecutive sparse ranges to reduce these reloads. Heavy-light path. The pairs of a frontier value and a rare value are numerous, but each row that holds a rare value also holds many frontier values. Hence, for counts, the heavy-light path gathers the rows of a batch of rare values and counts their pairs with the frontier values on the matrix accelerator, building the tiles from a bitmap of frontier values per row.

(a) Two-relation product

(b) Similarity
Figure 8: The same split of the result between the grid and the sparse path serves other queries. Each square is the result with the values in rank order. (a) A product of two relations has one frontier per input. (b) Item similarity also skips the pairs whose sizes differ too much to reach the threshold.
3.5 Running Inside Database Engines
Tessera should run inside existing database engines and follow each engine's own rules for running queries and managing resources, or the engine cannot use it for real queries. What makes this challenging is that engines differ widely in both respects. Exporting the input to an external program would sidestep these differences, but it would copy the data out and the result back, and the engine could no longer limit or cancel the work. Writing the operator inside one engine would avoid the copies, but it would tie the operator to that engine's plan structures, and every further engine would need the whole design again. Our design keeps the operator independent of any engine and reaches each engine through the interfaces that engines already offer to extensions. Therefore, the core of Tessera is a library with a small C interface, which takes the input rows and returns the result cells, and each engine calls it through a thin adapter.
The operator interface. A narrow interface keeps the engine and Tessera apart. It takes the input rows in batches, the query with its options, and a cancellation callback, and it returns result rows that the adapter converts to the engine's types. Hence, the engine never sees how Tessera computes the result, and Tessera never sees the engine's plan structures.
What an engine must provide. Any engine that offers three common extension points can host Tessera. First, a hook puts Tessera in place of the join and the aggregation. With an extensible optimizer or planner, the adapter replaces the subplan, and users keep writing the original SQL. Without one, Tessera is a table function that the query names. Second, the adapter reads the input rows with the engine's own scan, and third, it returns the cells as rows in the engine's types. Since relational, embedded, and dataflow engines all offer these interfaces to extensions, Tessera runs in them without changes to their code.
Leaving a query to the engine. Tessera does not speed up every join, and the adapter leaves the joins that it cannot speed up to the engine. Tessera pays for every input row, because it builds the rows of X from them, while the engine's hash join and aggregation pay for every joined row. Therefore, a join that adds few rows to its input runs faster in the engine. The adapter estimates the joined rows per input row from the row and distinct counts that the engine keeps for each table. Since this estimate assumes uniform keys, it misses the skew that makes a join large and gives the matrix repeated pairs to aggregate. The adapter therefore leaves a join to the engine only below a limit at which Tessera is clearly slower even on uniform keys.
Resources of the engine. Tessera uses the engine's resources as one of the engine's own operators would. Its worker threads run on the CPUs of the calling thread and leave signals, such as a statement timeout, to the engine's thread. The output, which can grow with the square of the number of values, spills to the engine's temporary directory under its memory limit, while the input rows, , and each thread's counters grow linearly and stay in memory. Since engines cancel cooperatively, Tessera polls a cancellation callback between phases and once per work item of the products, and the adapter then raises the engine's own cancellation error.
3.6 Two-Relation Products and Item Similarity
Tessera also supports products of two relations and item similarity. Both reuse the grid and the sparse path and change only how the ranked result is split between them.
Two-relation products. For , the values of both inputs share one rank space with four ranges, the frontier of , the frontier of , and the remaining values of each input. The grid multiplies only blocks of 's frontier with blocks of 's frontier, and the sparse path scans only the other input's ranges of each row. A variant of the cost model chooses the two frontiers together, with the tile term counting tile pairs across the inputs. Figure 8 (a) shows this split.
Similarity. For item similarity, Tessera computes each pair's similarity when it emits the cell, from the exact count and the sizes and , and keeps the pairs above the threshold . For sets, a pair can reach only if the smaller size is at least a fraction of the larger, for cosine and for Jaccard. Since values are ranked by size, this becomes a smallest rank for the partners of each value . The grid skips the blocks below this rank, and the sparse path starts each row's scan at it, as Figure 8 (b) shows.
3.7 Other Matrix Accelerators
Our prototype targets Intel AMX [34], and porting it to other CPU matrix accelerators is future work. Such accelerators also accumulate products of 8-bit values into 32-bit sums, such as the outer-product instructions of Arm SME [6] and the matrix facility of IBM Power10 [41]. Since the grid and the cost model rely only on such products, we expect them to carry over, with three differences. First, since the 8-bit products of Power10 take one signed operand, weights above 127 need a second product. Second, SME tiles follow the vector length of the processor, and the panel width must follow it too. Third, both accumulate outer products of vectors instead of multiplying two tiles loaded from memory, which changes how panels feed the products and what the cost model charges per tile.
4 IMPLEMENTATION
Tessera is released for four widely used database engines, DuckDB, PostgreSQL, Spark, and SQLite, and users install it with one command, as they install any other extension of their engine. It consists of a core library of about 4,600 lines of C++ and one adapter per engine, built with the core into an extension that changes no engine source (Table 2). In DuckDB, PostgreSQL, and Spark, the adapter rewrites the plan of the original SQL, which needs no change, and in SQLite, Tessera runs as table functions. On x86-64, the core picks AMX, AVX-512, or AVX2 at runtime, and other CPUs, such as Apple silicon, run a portable build. Without AMX, every value runs on the sparse path, and on an x86-64 CPU without AVX2, the adapters leave every query to the engine. The grid uses the AMX instruction TDPBUUD for products of unsigned 8-bit values.
Table 2: How the adapters attach Tessera to four engines, and where users install it.
| Engine | Plan hook | Input rows | Package | Lines |
|---|---|---|---|---|
| DuckDB v2.0.0 | optimizer rule | parallel sink | community | 2,016 |
| PostgreSQL 18.6 | planner hook | heap scan | PGXN | 1,052 |
| Spark 4.2.0 | planner strategy | partitions | Maven Central | 1,050 |
| SQLite 3.54.1 | table function | statement | PyPI | 526 |
Table 3: Relations in the evaluation.
| Relation | k / x | Keys | Values | Rows |
|---|---|---|---|---|
| NYTimes [43] | Article / word | 300 K | 102 K | 69.7 M |
| PubMed [43] | Abstract / word | 8.2 M | 141 K | 483 M |
| MovieLens [27] | User / movie | 201 K | 84 K | 32.0 M |
| kosarak [25] | Session / page | 990 K | 41 K | 8.0 M |
| human_gene1 [18] | Gene / gene | 22 K | 22 K | 24.7 M |
| LiveJournal [36, 56] | Vertex / vertex | 4.0 M | 4.0 M | 69.4 M |
| Orkut [36, 56] | Vertex / vertex | 3.1 M | 3.1 M | 234 M |
Distribution. In DuckDB, INSTALL tessera FROM community fetches the extension, which the community extension repository builds from the public source. PostgreSQL users run pgxn install tessera_pg, which builds the extension against the local server, and Spark users add the artifact on Maven Central with -packages. Python programs install the SQLite extension from PyPI, and other SQLite users load it from a release archive. The binary packages target Linux on x86-64 and macOS on Apple silicon. At each release, a continuous-integration workflow builds and tests the PostgreSQL, Spark, and SQLite packages.
The C interface. The PostgreSQL, SQLite, and Spark adapters call the C interface of the core library, and the DuckDB adapter calls the same query code in C++. An adapter passes the rows of its engine's scan, the memory limit, and a cancellation callback, and reads back the result rows. Strings are coded in byte order, which keeps the meaning of a. x < b. x under a byte-order collation.
Adapters. The adapters of DuckDB, PostgreSQL, and Spark leave a join to the engine below a limit on its estimated joined rows per input row. We set each limit where Tessera becomes twice as slow as the engine's plan for a self-join on uniform keys, which gives six in DuckDB v2.0.0, four in the v1.3.2 build of the evaluation, and no limit in PostgreSQL and Spark, whose plans are never twice as fast. The adapters pass thresholds and the engine's memory limit for the output of Tessera, except the Spark adapter, which runs Tessera in the driver. On integer and string keys, weights of one type, pair filters, thresholds, two relations, and similarity, every

Figure 9: Execution time in DuckDB. Tessera is faster than every existing system on every relation. Labels give the speedup over the fastest existing system.
Tessera -- DuckDB v1.3.2 • Apriori SQL (v1.3.2) ▲ NYTimes ● kosarak
-- DuckDB 1.5.6 • Apriori SQL (1.5.6) ■ MovieLens

(a) NYTimes, HAVING
(b) MovieLens, HAVING
(c) kosarak, HAVING
(d) Top-k
Figure 10: Execution time of pruned queries in DuckDB, which keep pairs above a support (a–c) or the top k (d). Tessera is far faster than the engine at every support and k, since it drops the values that cannot qualify before counting. Support is the share of keys in which a pair must appear.
adapter returns the same rows as the engine’s own plan, up to floating-point rounding, and raises the same overflow errors.
5 EVALUATION
5.1 Methodology
Testbed. The server has two Intel Xeon Silver 4514Y processors with 16 cores, 2 MB of L2 cache per core, and 30 MB of L3 cache each, and 256 GB of DDR5 memory [32], and it runs Ubuntu 24.04 with Linux 6.17. Every run uses the 16 cores of one socket and the 128 GB of its NUMA node, and every engine runs with the same 100 GB memory limit, which keeps it within this node. Each time is the median of five runs after a warm-up, and runs longer than a minute are measured once.
Compared systems. We compare Tessera with the engines' own plans, with SPALM, and with programs outside the engines, all from their public code without changes. The engines' own plans build every joined row and then aggregate the joined rows. In DuckDB, we run the plan of DuckDB v1.3.2 with the Tessera rule disabled and that of the newer DuckDB 1.5.6, and in PostgreSQL, SQLite, and Spark, the plan of each engine. SPALM [35] is an in-database linear algebra system that picks a sparse or a dense kernel for each block of the product inside DuckDB and writes a dense result of all pairs. It requires DuckDB v1.3.2, uses the constants of its own calibration script, and runs per block of result rows where its 32-bit offsets overflow. Since it does not accept a. x < b. x, it is left out of the pruned queries. In DuckDB, we call the fastest of the two plans and SPALM on each query the fastest existing system. Outside the engines, the core of Tessera runs on rows already in memory against four kinds of programs. The SYRK of oneMKL [33] and SuiteSparse:GraphBLAS [16, 17] are sparse matrix libraries that compute . MMJoin [9, 19] is a standalone implementation of the join-project algorithm, which multiplies the frequent values as a dense matrix and joins the rare ones. Eclat [10] and FP-growth [11] are frequent itemset miners, which we limit to itemsets of size two. The similarity joins of Mann et al. [39] (AllPairs [8], PPJoin [54], and GroupJoin [12]), the parallel AllPairs of Fier et al. [22], and L2AP [5] find similar sets with prefix filters. Single-thread programs run against one thread of Tessera, and inside the engines, the times include the engine's scan and the output in the engine's types.
Workloads. Table 3 lists the relations. With values numbered by frequency, x < 8192 selects the block of the 8,192 most frequent values, the heavy block that motivates in-database linear algebra [19, 35]. For PubMed and the graphs, we run only such blocks, since a dense result of all pairs, which SPALM writes, would need 148 GB on PubMed and terabytes on the graphs. We run the full product with COUNT and two pruned queries, which keep only strong pairs. The first is a. x < b. x with a HAVING threshold from 1% to 0.1% support, the share of keys in which a pair must appear [25], and the second is top-k with k from 10 to . The deep dive uses the threshold , which is 0.33% support on the news articles and 0.50% on the ratings. Two-relation products join the movie ratings with the

Figure 11: Tessera outperforms the plans of Spark, PostgreSQL, and SQLite on every query. All pairs is the full product of the block, and is the HAVING threshold.
2.0 million tags that users attach to movies, once on the user and once on the movie. They also join the cast, the keywords, and the companies of IMDb movies on the movie. Similarity compares the items' sets of keys, and a light consumer computes the count and the sum of the result rows.
5.2 Main Results
Comparison with existing systems. Figure 9 shows that Tessera outperforms every existing system on every relation. On the full products, it is faster than the fastest existing system by to , and on the heavy blocks, which suit SPALM best, by to . For example, on the news articles, Tessera takes 2.9 seconds, SPALM 54.3 seconds, and the engine 8.6 minutes. On the gene matrix, the engine takes 30 minutes against 1.0 second for Tessera, a gain of . This is because the engine processes every joined row and SPALM zeroes and scans a dense result of all pairs, while Tessera computes one half of the result and writes only nonzero cells.
Impact of the query’s threshold. Figure 10 shows that the time of Tessera grows only slowly as a pruned query keeps more pairs, while the engine takes the same time at every threshold and k. For example, its top-k queries on the news articles take under one second for every k, against 226 seconds for the engine. This is because the engine filters the aggregated groups, while the bound of Tessera removes values before the product. Tessera also outperforms the frequent-item filter of Apriori [3, 46] written in SQL, which gives the engine part of this bound, by to on the news articles and the ratings. Only on kosarak at 1% support, where few values reach the threshold, is the rewrite faster, by .
Speedup in other engines. In PostgreSQL and Spark, the queries run on the block of the 8,192 most frequent values. In SQLite, whose plan runs on one thread, they run on the blocks of the 2,048 and 1,024 most frequent values. Figure 11 shows that Tessera outperforms the plans of Spark, PostgreSQL, and SQLite on every query, by to . This is because these plans also build and aggregate every joined row. Even on one thread, Tessera is faster than the plan of SQLite by to .
Comparison with sparse libraries and itemset miners. Figure 12 (a) shows that the core of Tessera outperforms the SYRK
NYTimes MovieLens kosarak human_gene1
Over Eclat -- Over FP-growth Out of memory

(a) Against sparse libraries
(b) Frequent pairs, one thread
Figure 12: Speedup of the core of Tessera outside the engines over sparse libraries, MMJoin, and itemset miners. MKL is oneMKL SYRK, GrB is GraphBLAS, MMJ is MMJoin, All is all pairs, and 1T is one thread.
Tessera SPALM DuckDB 1.5.6 DuckDB v1.3.2

(a) MovieLens ratings × tags
(b) IMDb, joined on the movie
Figure 13: Products of two relations in DuckDB. Tessera speeds up joins with many joined rows and leaves the others to the engine. P, K, and C are the cast, the keywords, and the companies.
of oneMKL and GraphBLAS on the full product by to . This is because both assemble a sparse matrix, and GraphBLAS also computes both halves and applies the threshold after the product. The core of Tessera, which writes the pairs, is also faster than MMJoin, which only counts them, by to at 0.3% support. Figure 12 (b) shows that on one thread, Tessera counts the frequent pairs faster than Eclat and FP-growth by to on the news articles and the ratings, where FP-growth does not run out of memory. On kosarak, whose sessions are short, this gain shrinks to .
5.3 Two Relations and Item Similarity
We now show that Tessera also supports two other kinds of join-aggregates, products of two relations and item similarity, and that it speeds them up where they produce many joined rows or result pairs.
Two-relation products. Figure 13 (a) shows that Tessera is faster than SPALM by to and than DuckDB 1.5.6 by to on the two joins, while DuckDB v1.3.2 runs out of memory on the join on the user. Since the tags have no dense core, the cost model chooses no frontier, and the gain comes from the sparse
Tessera Parallel AllPairs (Fier et al.) GraphBLAS Wrong result (missed or extra pairs)

(a) kosarak, Jaccard
(b) kosarak, cosine
(c) MovieLens, Jaccard
(d) MovieLens, cosine
Figure 14: Execution time of item similarity joins outside the engines on 16 threads. Tessera is faster than GraphBLAS at every threshold and than the parallel AllPairs of Fier et al. at 0.7 and below, with exact results. Hollow markers are runs that miss pairs or return extra ones.
NYTimes, Full MovieLens, Full human_gene1, Full
NYTimes, MovieLens,

(a) Gain of the matrix accelerator
(b) Scaling of Tessera
Figure 15: The matrix accelerator speeds up the core most where values form a dense block, and Tessera scales with the number of threads.
path and the output. Outside the engine, the core of Tessera still outperforms GraphBLAS by to .
Joins that add few rows. Figure 13 (b) shows that the adapter rightly leaves joins with few joined rows to the engine. The IMDb joins give only 2.1–5.3 joined rows per input row, and the estimate from the statistics of DuckDB, 1.1–2.0, lies below the limit of four. On these joins, DuckDB 1.5.6 outperforms a forced Tessera by 1.20× to 3.40×, since building X from up to 39 million rows takes longer than the engine's whole plan. With the limit, the three queries run in the engine's own time, while SPALM stops on two of the three. Similarity joins. Figure 14 shows that the time of Tessera grows by at most 2.9× as the threshold falls from 0.95 to 0.1. On the ratings with cosine similarity, the result grows from 1.6 million to 222 million pairs over this range, while the time of Tessera grows only from 0.45 to 1.29 seconds. On 16 threads, Tessera outperforms GraphBLAS, which filters after the full product, by 3.3× to 32.9×, and the parallel AllPairs of Fier et al. by up to 4.3× at 0.7 and below. On one thread, the joins of Mann et al. and L2AP lead by up to 75× at 0.95, while Tessera outperforms them by 2.3× to 3.2× at 0.1 on the news articles and the ratings. This is because a prefix filter prunes fewer candidates as the threshold falls, while Tessera counts each pair that shares a key once at any threshold. Tessera also returns the

(a) AMX against the vector units

(b) Cost model on unseen relations
Figure 16: AMX outperforms the vector units wherever a frontier is chosen, and the cost model stays near the best frontier on relations it was not fitted to. Hatched bars are HAVING queries, and (b) gives the share of 36 queries within each slowdown.
exact pairs, while the parallel join compares floating-point bounds with the threshold and misses up to 4.9% of the result.
5.4 Deep Dive
Gain of the matrix accelerator. Figure 15 (a) compares the core of Tessera with the same core without a frontier. On 16 threads, the gain ranges from on the full product of the news articles to on the gene matrix, the densest relation. It is larger on one thread, , since the panel setup and the heavy-light path scale less well than the sparse path. In DuckDB, the gain is up to , since the engine's scan and the consumer add the same time to both runs. However, the accelerator matters most where SPALM, whose dense kernels suit dense blocks, is strongest. It raises the gain of Tessera over SPALM from to on the blocks of the most frequent news words and ratings, and from to on the gene matrix. Figure 15 (b) shows that Tessera scales by to from one to 16 threads.
Matrix accelerator against vector units. Figure 16 (a) compares Tessera on AMX with the same grid on AVX-512 VNNI and with an AVX-512 build without a grid, which an AVX2 build matches

Figure 17: Ablation study of Tessera. The matrix accelerator, the grouped pair loop, and item pruning matter the most. Each bar is the slowdown with a mechanism disabled, against the full design at the dashed line.

Figure 18: A row-wise product with one design choice added at a time, where unsorted output rows and one half of the product gain the most. Times are relative to the sparse path of Tessera.
within 6%. On the relations with a frontier, AMX is faster than both by to . This is because a tile product on VNNI costs more, which raises the break-even density by the same factor. As a result, the grid on VNNI gains nothing on the news articles but still on the gene matrix, whose dense core is large. On kosarak, the AVX-512 build is faster than AMX by 10–14%, since AMX pays for the model's pass and then finds no frontier.
Ablation of each mechanism. Figure 17 disables one mechanism at a time, and the cost model picks the frontier of each run. The grouped pair loop gains to , and without it, the grid loses to running without a frontier on the full products of the news articles and the ratings. Item pruning gains up to on the pruned queries, and pruning and the accelerator together up to . In contrast, the heavy-light path and the row order change the time by at most .
Breakdown of the sparse path’s gain. Figure 18 starts from a row-wise product with a hash accumulator that computes both halves of the result and assembles a sorted sparse matrix, and adds one design choice at a time. Dense counters gain up to , computing one half about , and unsorted rows in per-thread chunks up to , which comes within 7% of the sparse path of Tessera on three relations. This is because a hash accumulator probes a table for every product, and a sorted matrix must sort and assemble its cells

(a) Frontier size

(b) Output memory limit
Figure 19: The cost model picks a frontier near the best fixed one, and a small output memory limit slows Tessera only slightly. In (a), stars are the cost model's choices, and dashed lines a dense copy of the frontier.
before any row reaches the engine. Both libraries fall between the first and the third step, and the sparse path outperforms them by to . Therefore, the gap to the libraries comes mainly from computing one half and writing rows instead of a matrix, which a relational result allows.
Need for a per-query frontier. Figure 19 (a) fixes the frontier of the full products at sizes from 0 to 32,768. A wrong size slows the product down by up to , when it is too small, as on the gene matrix, or too large, as on the news articles. There, the rare words give almost empty tiles that cost as much as full ones. The best size moves from 4,096 to 16,384 values across the three products. The cost model picks the best size on the news articles and the gene matrix and is 6.5% slower than the best on the ratings.
Cost model on unseen relations. The constants of the cost model come from four of the relations above. Figure 16 (b) runs the model on 18 other relations, including PubMed, the graphs, and six synthetic Zipf relations, with the full product and a HAVING query at 0.3% support on each. On 34 of the 36 queries, the product at the model's frontier is within 10% of the best forced frontier. With the model's own time, it falls behind the best by at most 1.35×. In contrast, the best fixed choice, no frontier, falls behind by up to 9.1×.
Comparison with a dense copy of the frontier. Figure 19 (a) also shows, as dashed lines, a simpler design that copies the frontier into a dense matrix with one row per key and multiplies it with a vendor library's 8-bit product (oneDNN on AMX). At its own best frontier, half the size that the cost model picks for the grid, this design comes within 5% of the grid on the three full products. Beyond that frontier, however, the grid outperforms it by up to 7.4×. This is because the copy has a row for every key and multiplies tiles of zeros, while the grid builds only the tiles in which rows hold values. As a result, an oversized frontier costs the grid little, and the cost model needs no exact tuning.
Impact of the output memory limit. Figure 19 (b) limits the memory for the output of the full products in the core of Tessera. At 256 MB, Tessera writes nearly all of the 571 and 883 million cells to files and is only 2.8% and 3.3% slower than without a limit. This is because each thread appends whole chunks to its own file, and the reader maps the files back instead of copying them. Hence, a

(a) PubMed, pruned queries

(b) Weighted sums, over SPALM
Figure 20: Where Tessera does not help, a frontier without a dense block and real weights on the gene matrix.
result larger than the engine’s memory costs little more than one that fits while its files stay in the page cache.
Cases with little gain. Without a dense block, as on kosarak, PubMed, and the graphs, the cost model keeps every value on the sparse path at a cost of at most 6.2%. Figure 20 (a) shows that on PubMed, frontiers of 1,024 and 4,096 values slow the HAVING query down by 1.08× and 1.23×, respectively, since its frequent block lies below the break-even density, and the cost model chooses none. Figure 20 (b) shows that with real weights, which run on the floating-point sparse path, Tessera outperforms SPALM by 8.7× to 10.5× on the news articles and the ratings, against 10.6× to 13.2× with integer weights. On the gene matrix, however, Tessera is only 1.1× faster, since the grid no longer takes its dense block.
6 RELATED WORK
Join-project and in-database linear algebra. Amossen and Pagh [4], Hu [28], and Deep et al. [19] split a join-project into heavy and light values, join the light ones, and run the heavy ones as a dense matrix product. Deng et al. [20] and DIM3 [30] split sets by size or columns by density in the same way. LevelHeaded [1] and SPALM [35] choose dense or sparse kernels for linear algebra inside a database. These designs speed up the multiplication of the frequent values but leave the rare values and the result on a slow path. Tessera instead treats the rare values and the result as the main work and gives the accelerator only the dense core.
Sparse matrix products. Sparse libraries [16, 17] compute row by row with Gustavson's algorithm [26] and a sparse [24] or hash accumulator, and some leave the rows of the product unsorted [42]. The SYRK of oneMKL [31] and SpSYRK [40] compute one triangle of a symmetric product. These libraries compute a matrix outside the database, while Tessera computes a relational result inside the engine and skips unneeded work.
Pair mining and similarity joins. Frequent itemset miners [3, 10, 11, 51] and their SQL forms [46] find the itemsets whose support exceeds a threshold, and similarity joins prune candidates with prefix and length filters [5, 8, 22, 39, 54]. These algorithms each serve one kind of query outside the database, while Tessera brings the same pruning to SQL queries inside the engine.
Matrix accelerators on sparse data. GPU kernels pack sparse rows or blocks into tensor-core tiles [21, 37, 38, 52, 58]. CPU kernels run sparse-dense products on AMX [2, 53] and on POWER10, where DDB [57] sends the denser blocks of each matrix to the matrix unit. SparseZipper [48] proposes new matrix instructions for sparse-sparse products. These works speed up one sparse kernel, some with new hardware, while Tessera runs whole queries in an engine on existing CPUs and gives the accelerator only their dense part.
7 CONCLUSION
This paper presented Tessera, a join-aggregate operator for database engines on skewed sparse relations. On such relations, most of the time goes to the rare values and the output rather than to the multiplication, which limits what a faster multiplier can gain. Therefore, Tessera made these parts cheap first and gave a CPU matrix accelerator only the dense core of frequent values, which a cost model sized for each query. In DuckDB, it outperformed the fastest existing system by to , and in four engines, it was up to three orders of magnitude faster than their own plans. We believe that the lesson of Tessera extends beyond join-aggregates. Matrix accelerators help a database engine most when it keeps its sparse, relational execution and hands them only the dense subproblems that skew creates, such as the heavy hitters of joins and group-bys, rather than recasting queries as dense linear algebra.
ACKNOWLEDGEMENT
This research was sponsored by the National Research Foundation of Korea (NRF) grants funded by the Ministry of Science and ICT (No. RS-2025-00522990). Gyuyeong Kim is the corresponding author.
REFERENCES
[1] Christopher R. Aberger, Andrew Lamb, Kunle Olukotun, and Christopher Ré. 2018. LevelHeaded: A Unified Engine for Business Intelligence and Linear Algebra Querying. In Proc. of IEEE ICDE. 449–460. https://doi.org/10.1109/ICDE.2018.00048
[2] Ahmed F. AbouElhamayed, Jordan Dotzel, Yash Akhauri, Chi-Chih Chang, Sameh Gobriel, J. Pablo Muñoz, Vui Seng Chua, Nilesh Jain, and Mohamed S. Abdelfattah. 2025. SparAMX: Accelerating Compressed LLMs Token Generation on AMX-powered CPUs. arXiv preprint arXiv:2502.12444 (2025).
[3] Rakesh Agrawal and Ramakrishnan Srikant. 1994. Fast Algorithms for Mining Association Rules. In Proc. of VLDB. 487–499. https://www.vldb.org/conf/1994/P487.PDF
[4] Rasmus Resen Amossen and Rasmus Pagh. 2009. Faster Join-Projects and Sparse Matrix Multiplications. In Proc. of ICDT. 121–126. https://doi.org/10.1145/1514894.1514909
[5] David C. Anastasiu and George Karypis. 2014. L2AP: Fast Cosine Similarity Search with Prefix L-2 Norm Bounds. In Proc. of IEEE ICDE. 784–795. https://doi.org/10.1109/ICDE.2014.6816700
[6] Arm Limited. 2023. Arm Architecture Reference Manual Supplement, The Scalable Matrix Extension (SME), for Armv9-A. Document DDI0616, issue B.a, https://developer.arm.com/documentation/ddi0616/latest.
[7] Michael Armbrust, Reynold S. Xin, Cheng Lian, Yin Huai, Davies Liu, Joseph K. Bradley, Xiangrui Meng, Tomer Kaftan, Michael J. Franklin, Ali Ghodsi, and Matei Zaharia. 2015. Spark SQL: Relational Data Processing in Spark. In Proc. of ACM SIGMOD. 1383–1394. https://doi.org/10.1145/2723372.2742797
[8] Roberto J. Bayardo, Yiming Ma, and Ramakrishnan Srikant. 2007. Scaling Up All Pairs Similarity Search. In Proc. of WWW. 131–140. https://doi.org/10.1145/1242572.1242591
[9] Chris Bellas. 2021. MMJoin: Fast SSJ/SCJ Project Query Evaluation using Matrix Multiplication. https://github.com/chribell/mmjoin, commit bed4654. An extension of the MMJoin implementation of Deep et al. to self-joins for set similarity and set containment. Accessed October 2026.
[10] Christian Borgelt. 2003. Efficient Implementations of Apriori and Eclat. In Proc. of the IEEE ICDM Workshop on Frequent Itemset Mining Implementations (FIMI) (CEUR Workshop Proceedings), Vol. 90. https://ceur-ws.org/Vol-90/borgelt.pdf
[11] Christian Borgelt. 2005. An Implementation of the FP-growth Algorithm. In Proc. of the 1st International Workshop on Open Source Data Mining (OSDM) at ACM SIGKDD. 1–5. https://doi.org/10.1145/1133905.1133907
[12] Panagiotis Bouros, Shen Ge, and Nikos Mamoulis. 2012. Spatio-Textual Similarity Joins. Proc. VLDB Endow. 6, 1 (2012), 1–12. https://www.vldb.org/pvldb/vol6/p1-bouros.pdf
[13] Andrei Z. Broder. 1997. On the Resemblance and Containment of Documents. In Proc. of Compression and Complexity of SEQUENCES. 21–29. https://doi.org/10.1109/SEQUEN.1997.666900
[14] Pieter Cailliau, Tim Davis, Vijay Gadepally, Jeremy Kepner, Roi Lipman, Jeffrey Lovitz, and Keren Ouaknine. 2019. RedisGraph GraphBLAS Enabled Graph Database. In Proc. of IEEE IPDPS Workshops. https://doi.org/10.1109/IPDPSW.2019.00054
[15] Aaron Clauset, Cosma Rohilla Shalizi, and M. E. J. Newman. 2009. Power-Law Distributions in Empirical Data. SIAM Rev. 51, 4 (2009), 661–703. https://doi.org/10.1137/070710111
[16] Timothy A. Davis. 2019. Algorithm 1000: SuiteSparse:GraphBLAS: Graph Algorithms in the Language of Sparse Linear Algebra. ACM Trans. Math. Software 45, 4 (2019), 44:1–44:25. https://doi.org/10.1145/3322125
[17] Timothy A. Davis. 2023. Algorithm 1037: SuiteSparse:GraphBLAS: Parallel Graph Algorithms in the Language of Sparse Linear Algebra. ACM Trans. Math. Software 49, 3 (2023), 28:1–28:30. https://doi.org/10.1145/3577195
[18] Timothy A. Davis and Yifan Hu. 2011. The University of Florida Sparse Matrix Collection. ACM Trans. Math. Software 38, 1 (2011), 1:1–1:25. https://doi.org/10.1145/2049662.2049663
[19] Shaleen Deep, Xiao Hu, and Paraschos Koutris. 2020. Fast Join Project Query Evaluation using Matrix Multiplication. In Proc. of ACM SIGMOD. 1213–1223. https://doi.org/10.1145/3318464.3380607
[20] Dong Deng, Yufei Tao, and Guoliang Li. 2018. Overlap Set Similarity Joins with Theoretical Guarantees. In Proc. of ACM SIGMOD. 905–920. https://doi.org/10.1145/3183713.3183748
[21] Ruibo Fan, Wei Wang, and Xiaowen Chu. 2024. DTC-SpMM: Bridging the Gap in Accelerating General Sparse Matrix Multiplication with Tensor Cores. In Proc. of ACM ASPLOS. 253–267. https://doi.org/10.1145/3620666.3651378
[22] Fabian Fier, Tianzheng Wang, Erkang Zhu, and Johann-Christoph Freytag. 2020. Parallelizing Filter-Verification Based Exact Set Similarity Joins on Multicores. In Proc. of SISAP (Lecture Notes in Computer Science), Vol. 12440. Springer, 62–75. https://doi.org/10.1007/978-3-030-60936-8_5
[23] Kevin P. Gaffney, Martin Prammer, Larry Brasfield, D. Richard Hipp, Dan Kennedy, and Jignesh M. Patel. 2022. SQLite: Past, Present, and Future. Proc. VLDB Endow. 15, 12 (2022), 3535–3547. https://doi.org/10.14778/3554821.3554842
[24] John R. Gilbert, Cleve Moler, and Robert Schreiber. 1992. Sparse Matrices in MATLAB: Design and Implementation. SIAM J. Matrix Anal. Appl. 13, 1 (1992), 333–356. https://doi.org/10.1137/0613024
[25] Bart Goethals and Mohammed J. Zaki. 2003. Advances in Frequent Itemset Mining Implementations: Introduction to FIMI03. In Proc. of the IEEE ICDM Workshop on Frequent Itemset Mining Implementations (FIMI) (CEUR Workshop Proceedings), Vol. 90. https://ceur-ws.org/Vol-90/intro.pdf
[26] Fred G. Gustavson. 1978. Two Fast Algorithms for Sparse Matrices: Multiplication and Permuted Transposition. ACM Trans. Math. Software 4, 3 (1978), 250–269. https://doi.org/10.1145/355791.355796
[27] F. Maxwell Harper and Joseph A. Konstan. 2015. The MovieLens Datasets: History and Context. ACM Transactions on Interactive Intelligent Systems 5, 4 (2015), 19:1–19:19. https://doi.org/10.1145/2827872
[28] Xiao Hu. 2024. Fast Matrix Multiplication for Query Processing. Proc. ACM Manag. Data 2, 2 (2024), 98:1–98:25. https://doi.org/10.1145/3651599
[29] Yu-Ching Hu, Yuliang Li, and Hung-Wei Tseng. 2022. TCUDB: Accelerating Database with Tensor Processors. In Proc. of ACM SIGMOD. 1360–1374. https://doi.org/10.1145/3514221.3517869
[30] Zichun Huang and Shimin Chen. 2022. Density-optimized Intersection-free Mapping and Matrix Multiplication for Join-Project Operations. Proc. VLDB Endow. 15, 10 (2022), 2244–2256. https://doi.org/10.14778/3547305.3547326
[31] Intel. 2024. mkl_sparse_syrk, Developer Reference for Intel oneAPI Math Kernel Library for C. https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-2/mkl-sparse-syrk.html. Accessed October 2026.
[32] Intel. 2026. Intel Xeon Silver 4514Y Processor: Ordering and Compliance. https://www.intel.com/content/www/us/en/products/sku/237557/intel-xeon-silver-4514y-processor-30m-cache-2-00-ghz/ordering.html. Recommended customer price, accessed October 2026.
[33] Intel. 2026. oneAPI Math Kernel Library (oneMKL). https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html. Accessed October 2026.
[34] Intel Corporation. 2026. Intel 64 and IA-32 Architectures Software Developer's Manual, Combined Volumes: 1, 2A, 2B, 2C, 2D, 3A, 3B, 3C, 3D, and 4. Order Number 325462-093US, https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html.
[35] Junyoung Kim and Kenneth A. Ross. 2026. SPALM: A Sparsity-Pattern-Adaptive Library for Matrices. Proc. ACM Manag. Data 4, 3 (2026), 236:1–236:27. https://doi.org/10.1145/3802113
[36] Jure Leskovec and Andrej Krevl. 2014. SNAP Datasets: Stanford Large Network Dataset Collection. https://snap.stanford.edu/data.
[37] Shigang Li, Kazuki Osawa, and Torsten Hoefler. 2022. Efficient Quantized Sparse Matrix Operations on Tensor Cores. In Proc. of SC. 1–15. https://doi.org/10.1109/SC41404.2022.00042
[38] Yuechen Lu, Lijie Zeng, Tengcheng Wang, Xu Fu, Wenxuan Li, Helin Cheng, Dechuang Yang, Zhou Jin, Marc Casas, and Weifeng Liu. 2024. AmgT: Algebraic Multigrid Solver on Tensor Cores. In Proc. of SC. 1–16. https://doi.org/10.1109/SC41406.2024.00058
[39] Willi Mann, Nikolaus Augsten, and Panagiotis Bouros. 2016. An Empirical Evaluation of Set Similarity Join Techniques. Proc. VLDB Endow. 9, 9 (2016), 636–647. https://doi.org/10.14778/2947618.2947620
[40] Thomas McFarland, Julian Bellavita, and Giulia Guidi. 2026. SpSYRK: Half the Work in Distributed Sparse Matrix Multiplication. arXiv:2608.09713. To appear in SC Workshops.
[41] José E. Moreira et al. 2021. A Matrix Math Facility for Power ISA Processors. arXiv:2104.03142.
[42] Yusuke Nagasaka, Satoshi Matsuoka, Ariful Azad, and Aydin Buluç. 2019. Performance Optimization, Modeling and Analysis of Sparse Matrix-Matrix Products on Multi-Core and Many-Core Processors. Parallel Comput. 90 (2019), 102545. https://doi.org/10.1016/j.parco.2019.102545
[43] David Newman. 2008. Bag of Words. UCI Machine Learning Repository, https://doi.org/10.24432/C5ZG6P. https://doi.org/10.24432/C5ZG6P
[44] Mark Raasveldt and Hannes Mühleisen. 2019. DuckDB: An Embeddable Analytical Database. In Proc. of ACM SIGMOD. 1981–1984. https://doi.org/10.1145/3299869.3320212
[45] Recommenders contributors. 2026. SARplus (contrib/sarplus in the Recommenders Repository). https://github.com/recommenders-team/recommenders/tree/main/contrib/sarplus. Accessed October 2026.
[46] Sunita Sarawagi, Shiby Thomas, and Rakesh Agrawal. 1998. Integrating Association Rule Mining with Relational Database Systems: Alternatives and Implications. In Proc. of ACM SIGMOD. 343–354. https://doi.org/10.1145/276304.276335
[47] Gábor Szárnyas, Jack Waudby, Benjamin A. Steer, Dávid Szakállás, Altan Birler, Mingxi Wu, Yuchen Zhang, and Peter Boncz. 2022. The LDBC Social Network Benchmark: Business Intelligence Workload. Proc. VLDB Endow. 16, 4 (2022), 877–890. https://doi.org/10.14778/3574245.3574270
[48] Tuan Ta, Joshua Randall, and Christopher Batten. 2025. SparseZipper: Enhancing Matrix Extensions to Accelerate SpGEMM on CPUs. arXiv preprint arXiv:2502.11353 (2025).
[49] The PostgreSQL Global Development Group. 2026. PostgreSQL 18.6 Documentation. https://www.postgresql.org/docs/18/. Release 18.6, August 2026. Accessed October 2026.
[50] Transaction Processing Performance Council. 2025. TPC Express Big Bench (TPCx-BB) Standard Specification, Version 1.7.0. https://www.tpc.org/TPC_Documents_Current_Versions/pdf/TPCX-BB_v1.7.0.pdf.
[51] Takeaki Uno, Tatsuya Asai, Yuzo Uchida, and Hiroki Arimura. 2003. LCM: An Efficient Algorithm for Enumerating Frequent Closed Item Sets. In Proc. of the IEEE ICDM Workshop on Frequent Itemset Mining Implementations (FIMI) (CEUR Workshop Proceedings), Vol. 90. https://ceur-ws.org/Vol-90/uno.pdf
[52] Yuke Wang, Boyuan Feng, Zheng Wang, Guyue Huang, and Yufei Ding. 2023. TC-GNN: Bridging Sparse GNN Computation and Dense Tensor Cores on GPUs. In Proc. of USENIX ATC. 149–164.
[53] Ziqi Wang, Dongsheng Li, and Huayou Su. 2026. SparX: Cache-Aware Sparse Matrix Multiplication Kernels on AMX-Based CPUs. In Proc. of Euro-Par (LNCS), Vol. 16782. 571–584. https://doi.org/10.1007/978-3-032-35251-4_39
[54] Chuan Xiao, Wei Wang, Xuemin Lin, and Jeffrey Xu Yu. 2008. Efficient Similarity Joins for Near Duplicate Detection. In Proc. of WWW. 131–140. https://doi.org/10.1145/1367497.1367516
[55] Weipeng P. Yan and Per-Åke Larson. 1995. Eager Aggregation and Lazy Aggregation. In Proc. of VLDB. 345–357. https://www.vldb.org/conf/1995/P345.PDF
[56] Jaewon Yang and Jure Leskovec. 2012. Defining and Evaluating Network Communities Based on Ground-Truth. In Proc. of IEEE ICDM. 745–754. https://doi.org/10.1109/ICDM.2012.138
[57] Serif Yesil, José E. Moreira, and Josep Torrellas. 2022. Dense Dynamic Blocks: Optimizing SpMM for Processors with Vector and Matrix Units Using Machine Learning Techniques. In Proc. of ICS. 1–14. https://doi.org/10.1145/3524059.3532369
[58] Orestis Zachariadis, Nitin Satpute, Juan Gómez-Luna, and Joaquín Olivares. 2020. Accelerating Sparse Matrix-Matrix Multiplication with GPU Tensor Cores. Computers & Electrical Engineering 88 (2020), 106848. https://doi.org/10.1016/j.compeleceng.2020.106848