PandaDB: Understanding Unstructured Data in Graph Database

Zihao Zhao, Zhihong Shen, Mingjie TangarXiv 2021

Abstract

Unstructured data (e.g., images, videos, PDF files, etc.) contain semantic information, for example, the facial feature of a person and the plate number of a vehicle. There could be semantic relationships between data items which are not explicitly represented. For example, a person's face may appear in two irrelevant photos. Also, much information is represented as structured data (e.g., the person's name and age). End-users prefer to query the semantic information from unstructured data together with structured data based on the potential relationships among them. However, due to the lack of a unified database system for structured and unstructured data, developers have to comprise multiple systems and runtime together to answer these queries. In this work, we build an open-source graph database named PandaDB to consistently manage and query structured and unstructured data. We first introduce a graph data model to manage structured and unstructured data, then propose a new query language to understand the semantics of the unstructured data in the graph. Next, we develop a new cost model and related query optimization techniques to speed up the unstructured data processing pipeline. Finally, we optimize the unstructured data storage and provide the index to speed up the query processing over unstructured data. PandaDB is widely used in industrial applications like FinTech, Knowledge Graph, and Recommendation System. The results show PandaDB can support a large scale of unstructured data query processing in a graph.

Introduction

In modern applications, data is rarely just a set of numbers and strings. We often have "hybrid" data: a person’s name (structured) associated with their photo (unstructured). Traditionally, if you wanted to find "all teammates of Michael Jordan who wear a red jersey," you’d have to query a database for the teammates, fetch their photos from a file system, and run an external AI model to identify jersey colors.

This "decoupled" approach creates three major headaches: complexity in managing multiple systems, performance bottlenecks when moving large binary files, and optimization blindness, where standard database optimizers cannot account for the high cost of AI inference.

Methods

The authors built PandaDB on top of Neo4j, extending it in several key areas to bridge the gap between structured records and unstructured content.

Graph Data Model and CypherPlus

PandaDB introduces a graph data model that treats unstructured data as first-class citizens. As illustrated in the figure below, entities such as people and teams are represented as nodes, while their unstructured counterparts (e.g., photos) are linked via semantic relationships. This allows for complex queries that span both data types.

A graph data model in PandaDB linking structured entities (names, teams) with unstructured data (images) through semantic relationships.

They extended the standard Cypher language into CypherPlus, which includes a "sub-property" extractor (->). For example, n.photo->jerseyNumber tells the system to extract a specific semantic feature from an image. They also added logical comparison symbols for similarity (e.g., ~: for "looks like").

AI-Aware Cost-Based Optimizer (CBO)

This is the "brain" of PandaDB. Unlike standard optimizers, PandaDB’s CBO estimates the cost of AI inference in real-time. It uses a greedy algorithm to reorder query steps, ensuring that cheap structured filters (like name = 'Jordan') run before expensive unstructured operations (like facial recognition).

Hybrid Storage and PandaAI

PandaDB introduces a BLOB (Binary Large Object) data type. Small files are stored directly in the graph, while large files are managed by a specialized BLOBValueManager backed by HBase. This allows the system to load metadata lazily without reading the entire binary file into memory. The PandaAI service layer handles the interaction between the database kernel and various AI models (TensorFlow, PyTorch, etc.), providing a unified interface for semantic extraction.

Key Results

The researchers evaluated PandaDB using benchmarks like LDBC-SNB, LFW, and SIFT. Key findings include:

  • Massive Speedups: PandaDB achieved 100x to 1000x faster query execution than manual pipelines by optimizing the order of operations.
  • Storage Efficiency: Data import overhead was reduced by 20% compared to standard Neo4j.
  • I/O Performance: Specialized BLOB storage was 10x faster at reading unstructured items than standard byte-array methods.
  • High Accuracy: Vector indexing for semantic search maintained a recall rate of over 0.95.

PandaDB is currently used in industrial applications like FinTech, Knowledge Graph, and Recommendation Systems, demonstrating its ability to support large-scale unstructured data query processing.

Conclusion

PandaDB demonstrates that integrating AI-driven semantic extraction into the database kernel can significantly improve the performance and usability of hybrid data systems. Future work will focus on automating parameter tuning for cost estimation, expanding multi-modal query support, and improving dynamic indexing for real-time AI model updates.

Summary updated

BibTeX
@misc{zhao2021pandadb,
  author = {Zihao Zhao and Zhihong Shen and Mingjie Tang},
  title = {{PandaDB: Understanding Unstructured Data in Graph Database}},
  year = {2021},
  eprint = {2107.01963},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.01963},
}
Figure