Abstract
Modern analytical workloads frequently involve navigating complex relationships between entities, such as identifying similar authors in citation networks or tracing semantic predications in biomedical databases. Traditional relational engines and graph databases often struggle with these "relationship queries" due to high join overhead and inefficient memory access patterns. This paper presents GQ-Fast, a specialized in-memory analytics engine that achieves speedups of 100x to 10,000x over state-of-the-art systems. GQ-Fast utilizes a novel fragment-based data organization, aggressive non-random access compression, and a query compiler that generates optimized C++ code to maximize hardware efficiency.
Introduction
Online Analytical Processing (OLAP) on graph-structured data is increasingly common in domains like bioinformatics and social network analysis. These workloads are characterized by "relationship queries"—SQL queries involving multiple joins, selections, and aggregations over entity and relationship tables. For instance, a researcher might query a database to find authors who frequently publish on specific terms within a certain timeframe.
While SQL is the standard for such queries, existing architectures face significant bottlenecks. Row-stores suffer from expensive scans, while column-stores materialize massive intermediate results and struggle with the random access patterns inherent in graph traversal. Graph databases, while optimized for navigation, often lack the raw analytical throughput required for heavy aggregation. GQ-Fast addresses these challenges by reimagining data storage and query execution specifically for relationship-heavy workloads.
Fragment-Based Data Organization
The foundational innovation of GQ-Fast is its fragment-based data organization. Instead of traditional row-oriented or columnar storage, GQ-Fast organizes data into fragments based on entity relationships. For any given entity, the system stores a contiguous list of related entities or attributes.
As shown in Figure 1, the schema typically consists of Entity Tables and Relationship Tables. By pre-organizing the relationship tables (like DT for Document-Term or DA for Document-Author) into fragments indexed by entity IDs, the engine can jump directly to relevant data. This structure effectively acts as a built-in join index, eliminating the need for expensive hash joins or nested loop scans during query execution.
Aggressive Compression and Compiled Execution
To fit massive datasets into RAM while maintaining high performance, GQ-Fast employs two key strategies: specialized compression and code generation.
Non-Random Access Compression
Traditional databases use compression techniques that allow for random access to individual elements (e.g., dictionary encoding). GQ-Fast observes that relationship queries typically process an entire fragment (all neighbors of a node) at once. By relaxing the requirement for random access within a fragment, GQ-Fast can use much denser compression methods.
As illustrated in Figure 6, different data types and distributions are handled by specialized encodings. For example, Huffman encoding is used for frequent values, while byte-aligned bitmaps efficiently represent sets of related IDs. This aggressive compression not only reduces the memory footprint but also accelerates execution by minimizing the data transferred from main memory to the CPU cache.
Bottom-Up Pipelining via Code Generation
Rather than using a traditional iterator-based query executor, GQ-Fast compiles SQL query plans directly into highly optimized C++ code. This "bottom-up" approach uses nested for loops to process data fragments. By keeping intermediate results in CPU registers and avoiding the overhead of virtual function calls or materialization, the system maximizes instruction locality and allows the CPU to leverage out-of-order execution effectively.
Evaluation and Results
GQ-Fast was evaluated using real-world biomedical datasets, including PubMed (up to 900 million relationship rows) and SemMedDB. In a benchmark Author Similarity query on PubMed, GQ-Fast completed the task in 5.66 seconds, compared to 1.24 hours for MonetDB (a leading column-store) and 8.2 hours for PostgreSQL.
Furthermore, GQ-Fast outperformed Neo4j by one to three orders of magnitude. Despite maintaining multiple indexed copies of relationship tables to support multi-directional joins, the system's compression often resulted in a smaller total memory footprint than its competitors. The results demonstrate that specialized data structures and compilation can provide transformative performance gains for graph-analytical SQL workloads.
Conclusion
GQ-Fast demonstrates that by specializing for relationship queries and dense entity IDs, it is possible to achieve order-of-magnitude improvements in OLAP performance. While currently limited to static data and specific schema types, the fragment-based approach provides a powerful blueprint for the next generation of in-memory analytical engines, with significant potential for further acceleration via GPU offloading.
Summary updated