Manuscript Offprint

arXiv:2609.09002

Factorized and Vectorized Execution: Optimizing Analytical and Semantic Queries over Relations

Sunny Yasser, Anas Dorbani, Amine Mhedhbi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

SUNNY YASSER, Polytechnique Montréal, Canada

ANAS DORBANI, Polytechnique Montréal, Canada

AMINE MHEDHBI, Polytechnique Montréal, Canada

Many-to-many joins are central to analytical and semantic workloads such as fraud detection, network analysis, and recommendation, where insights arise from relationships between entities. These workloads often suffer from an explosion of intermediate results, sometimes orders of magnitude larger than the inputs. Factorized representations address this problem by exploiting conditional independence among attributes to encode intermediates more compactly. In some cases, they can reduce the output size asymptotically below the worst-case output size. However, adopting factorization in modern vectorized query processors remains challenging: factorized representations are hierarchical, whereas vectorized execution is built around flat, block-oriented processing. Prior approaches either rely on full materialization or support only restricted factorization layouts, sacrificing much of the benefits of both factorization and vectorization.

We present FFX, a novel engine for Fast Factorized eExecution. FFX is the first pipelined engine to support arbitrary factorization schemes while preserving full vectorization. The engine introduces packed factorized vectors and operators that maintain cache-friendly, contiguous layouts. Beyond analytics, FFX also co-optimizes semantic operators by serializing factorized intermediates into compact prompts for large language models (LLMs), substantially reducing token usage and inference cost while maintaining output quality and, in some cases, improving it. Together, these contributions enable efficient execution of join-heavy analytical queries, including queries augmented with semantic operators.

CCS Concepts: • Information systems → Query operators; Join algorithms; DBMS engine architectures.

Additional Key Words and Phrases: Factorization, Vectorization, Execution, Analytics, Semantic Processing, Language Models, Operators

ACM Reference Format:

Sunny Yasser, Anas Dorbani, and Amine Mhedhbi. 2026. Factorized and Vectorized Execution: Optimizing Analytical and Semantic Queries over Relations. Proc. ACM Manag. Data 4, 3, Article 178 (June 2026), 26 pages. https://doi.org/10.1145/3802055

1 Introduction

Many-to-many joins underpin a wide range of analytical workloads, in which insights arise from the structure of relationships between entities. A common analytical task is the enumeration of network substructures, such as common neighbourhoods and paths. For example, follower patterns inform social recommendations [15], while path queries trace traffic flow in computer networks [36]. Beyond analytics, these substructures are increasingly used as context for LLM inference in tasks such as recommendation [29] and network diagnosis [48].

Most networks are stored as records in RDBMSs, where enumerating substructures translates into complex multi-way joins. However, join evaluation often becomes a scalability bottleneck because

Authors' Contact Information: Sunny Yasser, Polytechnique Montréal, Montréal, QC, Canada, sunny.yasser@polymtl.ca; Anas Dorbani, Polytechnique Montréal, Montréal, QC, Canada, anas.dorbani@polymtl.ca; Amine Mhedhbi, Polytechnique Montréal, Montréal, QC, Canada, amine.mhedhbi@polymtl.ca.

Figure

This work is licensed under a Creative Commons Attribution 4.0 International License.

© 2026 Copyright held by the owner/author(s).

ACM 2836-6573/2026/6-ART178

https://doi.org/10.1145/3802055

178:2

Sunny Yasser, Anas Dorbani, and Amine Mhedhbi

intermediate results can exceed input sizes by orders of magnitude. As a result, this large size limits the efficiency of both traditional RDBMSs and even specialized graph analytics frameworks [42]. The problem is even more severe in emerging systems that interleave data analytics with semantic reasoning using LLMs [11–13, 20, 43]. In these systems, intermediate relations must be serialized as text and included in LLM prompts, making inference cost directly proportional to their size. This motivates our focus on join-heavy queries, including those augmented with LLM-powered semantic operators.

A promising approach to mitigating the explosion in intermediate result size is to use factorized representations [37]. They rewrite a multiset of flat tuples as a nested expression over unions and products by exploiting the distributivity of product over union, along with the commutativity of both operators. This representation factors tuples according to shared attribute-value prefixes: unions enumerate alternative values, while products combine subexpressions that vary independently under a shared prefix. For example, the tuples (a1,a2,a3)∈{(0,1,4),(0,2,4),(0,3,4),(0,1,5),(0,2,5),(0,3,5),(0,1,6),(0,2,6),(0,3,6)}(a_1, a_2, a_3) \in \{(0, 1, 4), (0, 2, 4), (0, 3, 4), (0, 1, 5), (0, 2, 5), (0, 3, 5), (0, 1, 6), (0, 2, 6), (0, 3, 6)\} can be rewritten more succinctly as (∪a1{0}×∪a2{1,2,3}×∪a3{4,5,6})(\cup_{a_1} \{0\} \times \cup_{a_2} \{1, 2, 3\} \times \cup_{a_3} \{4, 5, 6\}). Factorization can yield representations whose size is asymptotically smaller than the maximum possible output size, known as the AGM bound [2].

Despite these theoretical advantages, adopting factorization in vectorized query engines remains challenging. Factorization organizes results hierarchically, grouping variable-length sets of values, whereas vectorized execution processes flat blocks of tuples for CPU-efficient execution over contiguous memory. A second challenge is maintaining state dynamically. Selections at one level may propagate to dependent values, causing cascading updates across multiple levels of the hierarchy. This behaviour contrasts with vectorized execution, where tuple reduction is typically confined to a single selector. Existing systems such as FDB [3, 4] sidestep cascading updates by fully materializing fresh factorized results at each operator, at the cost of higher memory utilization and the loss of pipelining and cache-efficient processing. Other systems restrict factorization to simplify the engine, sacrificing much of the potential performance benefit [16, 19].

References (4)