Property graphs model data as nodes and edges — useful for social networks, supply chains, fraud detection, recommendation engines, and any domain where relationships are as important as the data itself. Oracle has had graph support for years (via Oracle Graph Server), but Oracle 23ai brings graph queries directly into SQL using the new ANSI SQL/PGQ standard.
Creating a property graph:
CREATE PROPERTY GRAPH company_graph
VERTEX TABLES (employees KEY (employee_id))
EDGE TABLES (
reports_to
SOURCE KEY (employee_id) REFERENCES employees
DESTINATION KEY (manager_id) REFERENCES employees
);
Querying the graph with SQL/PGQ:
SELECT *
FROM GRAPH_TABLE (
company_graph
MATCH (e IS employees) -[r IS reports_to]-> (m IS employees)
WHERE e.department_id = 10
COLUMNS (e.first_name AS employee, m.first_name AS manager)
);
Finding paths of arbitrary depth:
-- Find all employees up to 3 levels below a given manager
SELECT *
FROM GRAPH_TABLE (
company_graph
MATCH (top) -[IS reports_to]->+ (sub) -- + means one or more hops
WHERE top.employee_id = 100
COLUMNS (sub.employee_id, sub.first_name)
);
Why in SQL, not a separate graph query language?
This is the key insight. By embedding graph traversal in SQL, you can combine graph patterns with relational predicates, aggregations, and joins — in a single query. No need to move data to a dedicated graph database.
Oracle is the first major commercial RDBMS to implement the SQL/PGQ standard. This positions it well for use cases in fraud detection, network analysis, and knowledge graphs — all of which are growing rapidly in enterprise settings.
