Graph databases are becoming increasingly popular for applications that need to store and analyze complex and interconnected data, such as social networks, recommendation systems, or knowledge graphs. Graph databases allow you to model your data as nodes and edges, and query them using graph algorithms and languages.
However, most graph databases are separate from relational databases, which means that you need to maintain two different systems, migrate your data, and integrate your queries. Moreover, most graph databases are not designed to scale horizontally, which limits their performance and capacity.
What if you could use PostgreSQL as a graph database, and also scale it out across multiple nodes? This is where Apache AGE and Citus come in.
Apache AGE is a graph database extension for PostgreSQL that allows you to store, query, and analyze graph data in a relational database. Graph data is composed of nodes and edges that represent entities and relationships. With Apache AGE, you can use openCypher, a popular graph query language, to manipulate and explore graph data in PostgreSQL. You can also use SQL to query both graph and relational data in a hybrid way.
Some of the benefits of using Apache AGE are:
- You can leverage the power and reliability of PostgreSQL as a relational database system, while also gaining access to graph functionality.
- You can use existing PostgreSQL tools and libraries to work with graph data, without needing to migrate or integrate with a separate graph database.
- You can perform fast and efficient graph analysis using various algorithms and functions provided by Apache AGE.
- You can visualize and interact with graph data using Apache AGE Viewer, a web user interface for Apache AGE.
Citus is a PostgreSQL extension that transforms Postgres into a distributed database—so you can achieve high performance at any scale. With Citus, you extend your PostgreSQL database with new superpowers:
- Distributed tables are sharded across a cluster of PostgreSQL nodes to combine their CPU, memory, storage and I/O capacity.
- References tables are replicated to all nodes for joins and foreign keys from distributed tables and maximum read performance.
- Distributed query engine routes and parallelizes SELECT, DML, and other operations on distributed tables across the cluster.
- Columnar storage compresses data, speeds up scans, and supports fast projections, both on regular and distributed tables.
By combining Apache AGE and Citus, you can build a scalable graph database on PostgreSQL that can handle large volumes of complex and interconnected data. You can shard your graph data across multiple nodes using Citus, and query it using openCypher or SQL using Apache AGE. You can also join your graph data with your relational data using foreign keys or SQL joins.
To use Apache AGE and Citus together, you need to install both extensions on your PostgreSQL cluster.
But this may not work.
Apache AGE team is working on a new project that is based on integration of Apache AGE and Citus.
In this blog post, I introduced Apache AGE and Citus to build a scalable graph database on PostgreSQL. and how Apache AGE and Citus can work together.
We hope that this blog post was helpful and informative for you. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading!