Enterprise data is full of hidden relationships: citation chains in legal docs, service dependencies, approval hierarchies, and drug interactions. These connections often hold the most valuable insight, but SQL-only and vector search can miss them.
With Apache AGE now generally available, AI Functions in ai_extension in public preview, and graph visualization shipped in the PostgreSQL VS Code extension, Azure Database for PostgreSQL Flexible Server gives you everything you need to unlock this structural knowledge without adding a separate graph database to your stack.
Why Graphs? Because Relationships Are the Blind Spot
Vector search is great at finding similar content, but it’s weaker when the answer depends on relationships. For example, “does this new vendor contract conflict with existing obligations?” may return a relevant clause, but it won’t follow links across regions, obligation types, and counterparties to prove a real conflict.
Graph queries fill that gap by following connections across your data to surface paths and patterns that flat retrieval can’t see. Combine graph traversal with AI-based extraction and you get knowledge graph powered retrieval: LLM answers grounded in both the text and the structure of your data.
Enable Graph Queries Inside PostgreSQL
Apache AGE adds graph capabilities to PostgreSQL. You can write graph queries in openCypher and run them right alongside your SQL. That means no separate graph database to provision, no cross-database data movement, and no external synchronization pipeline is required. If you materialize a graph from relational tables, that graph representation still needs to be maintained as the source data changes, but it can be managed inside PostgreSQL with the same enterprise security, transactions, and operational model.
AGE is now generally available on Azure Database for PostgreSQL Flexible Server on PostgreSQL 16, PostgreSQL 17 and with support now extending to PostgreSQL 18. Key capabilities include:
- openCypher query language for expressive graph traversals
- ACID transactions - graph operations share PostgreSQL's full transactional guarantees
- BTREE and GIN indexes on graph properties for efficient querying at scale
- Mixed SQL + Cypher - JOIN graph results with relational tables in a single statement
Here's what it looks like in practice:
-- Load AGE extension LOAD 'age';
SET search_path = ag_catalog, "$user", public;
-- Create a knowledge graph
SELECT ag_catalog.create_graph('company_graph');
-- Query: Who should I talk to about the payment service?
SELECT *
FROM ag_catalog.cypher(
'company_graph',
$$
MATCH (s:Service {name: 'PaymentService'})
<-[:OWNS]-(t:Team)
<-[:MEMBER_OF]-(p:Person)
WHERE p.active = true
RETURN p.name, t.name, p.role
$$
) AS (person agtype, team agtype, role agtype);
That single query traverses from a service to its owning team to its active members, a three-hop relationship that would require nested subqueries or recursive CTEs in pure SQL.
📘 Apache AGE Extension — Documentation | GA Announcement Blog
Build Knowledge Graphs from Your Data
The hardest part of working with graphs is building the graph in the first place. AI Functions in ai_extension (now in Public Preview) solve this by bringing LLM-powered intelligence directly into SQL.
extract() is the standout for graph workflows. It discovers hidden relationships and entities from unstructured text, right inside a SQL query. Feed it contracts, support tickets, research papers, or any text-heavy data, and it pulls out the structured relationships you need to populate your knowledge graph.
The other operators complement the graph pipeline: rank() re-ranks retrieval results with state-of-the-art models from Microsoft Foundry, is_true() evaluates natural-language filter conditions, and generate() produces LLM responses which are all callable from SQL.
Together, they enable a powerful pattern: extract relationships, store them as a graph in AGE, query the graph, then rank and return results all within PostgreSQL.
-- Extract relationships from a support ticket
SELECT azure_ai.extract(
description,
ARRAY['relationships: object[] - {source, edge, target} triples']
)
FROM support_tickets;
-- Returns:
-- {
-- "relationships": [
-- {"source": "API gateway", "edge": "CAUSED_FAILURE_IN", "target": "auth service"},
-- ...
-- ]
-- }
📘 AI Functions — Documentation | Deep Dive Blog
Visualize Your Graph as You Build It
The PostgreSQL extension for VS Code now renders graph visualizations automatically from Cypher queries. Run a query, see the nodes and edges. This makes exploring, debugging, and presenting your graph data dramatically easier requiring no separate visualization tool.
📘 PostgreSQL Extension for VS Code
Build Graph-Augmented AI Applications and Agents with PostgreSQL
Graph doesn’t work alone. Azure Database for PostgreSQL also includes pgvector + DiskANN for fast vector search, the Azure AI Extension to call LLMs from SQL, and MCP Server support to connect your database to AI agents. Together, they let you build end-to-end Graph-augmented RAG pipelines in one database right from extraction and embeddings to graph storage, retrieval, ranking, and generation.
Use the PostgreSQL MCP Server to connect AI agents to your database, giving them the ability to traverse graphs, run vector searches, and answer questions grounded in your enterprise data.
📘 DiskANN How-To | Azure AI Extension | MCP Server Blog | Build AI Agents with PostgreSQL
Why Build Your Graph on PostgreSQL?
- You already have the data. AGE adds graph features next to your existing tables. There’s no migration or separate graph store needed. You can use SQL and Cypher together in one query and transaction.
- One database instead of many. Keep relational data, graphs, json data, vectors, and LLM calls in one managed service. Simplify backups, security, and billing.
- Enterprise-grade from day one. Zone-redundant HA, automated geo-backups, Microsoft Entra ID auth, encryption at rest and in transit, all inherited automatically.
Use Cases: Where Graph + AI Unlock What Tables and Vectors Alone Can’t
- Legal research — Extract citations and holdings, traverse precedent paths, and ground answers with the full citation chain (not just similar text)
- Fraud detection & AML — Build entity graphs from transactions and customer data, then use multi-hop traversals and AI summarization to explain suspicious rings, layering, and circular flows
- Enterprise knowledge & expertise routing — Construct a living knowledge graph from docs/tickets/repos; answer “who owns this?” and “who knows this?” with graph reasoning and ranked, source-backed responses
- IT incident triage & root cause analysis — Correlate incidents, services dependencies, deployments/config changes; traverse blast radius and generate an RCA narrative with supporting evidence
- Supply chain risk & resiliency — Extract supplier relationships from contracts and POs, model tier-N dependencies, and let copilots flag sole-source bottlenecks and propose mitigations
- Regulatory compliance automation — Link regulations, obligations, controls and systems/vendors; run impact analysis on new rules and auto-generate control mapping and gap assessment
- Life sciences knowledge discovery — Connect drugs, targets, pathways, indications, and adverse events; traverse causal chains and generate explainable interaction/contraindication summaries
- Customer support & case deflection — Turn tickets, product telemetry, and KB articles into a graph; retrieve via graph paths and generate step-by-step resolutions
Get Started: Try It Now
We've built solution accelerators so you can see graph in action on Azure Database for PostgreSQL today:
|
Resource |
Link |
|
Contract Intelligence Platform |
https://github.com/james-tn/graph/tree/main/contract_intelligence |
|
Agentic Shop | |
|
GraphRAG Legal Research Copilot | |
|
Build Your Own Advanced AI Copilot | |
|
GraphRAG + Docker + AI Agents | |
|
Microsoft Learn — Implement GraphRAG Lab | |
|
AGE MCP Server (Claude Desktop / VS Code) |
Enabling Apache AGE takes minutes : navigate to Server Parameters in the Azure Portal, enable AGE under azure.extensions and shared_preload_libraries, save, and run
CREATE EXTENSION age CASCADE;.
That's it, your PostgreSQL database is now a graph database.
Don't Miss the Edges
The most valuable knowledge in your data isn't sitting in rows, it's hiding in the connections between them. These relationships are the structural context that makes AI applications genuinely intelligent.
Enable graph on your Azure Database for PostgreSQL today, and start surfacing the relationships your data has been hiding all along.