Skip to content

Commit 400bf67

Browse files
authored
Merge pull request #35572 from wmwxwa/patch-1
Refresh graph database overview
2 parents 1131bbf + 9e894bf commit 400bf67

1 file changed

Lines changed: 48 additions & 36 deletions

File tree

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
2-
title: "Graph processing"
2+
title: Graph Processing
33
titleSuffix: SQL Server and Azure SQL Database
4-
description: "Graph processing with SQL Server and Azure SQL Database"
4+
description: Graph processing with SQL Server and Azure SQL Database
55
author: MikeRayMSFT
66
ms.author: mikeray
7-
ms.date: 06/28/2023
7+
ms.reviewer: randolphwest
8+
ms.date: 10/14/2025
89
ms.service: sql
910
ms.topic: reference
1011
ms.custom:
@@ -15,85 +16,96 @@ helpviewer_keywords:
1516
monikerRange: "=azuresqldb-current || >=sql-server-2017 || >=sql-server-linux-2017 || =azuresqldb-mi-current"
1617
---
1718
# Graph processing with SQL Server and Azure SQL Database
18-
[!INCLUDE[sqlserver2017-asdb-asdbmi-fabricsqldb](../../includes/applies-to-version/sqlserver2017-asdb-asdbmi-fabricsqldb.md)]
1919

20-
[!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] offers graph database capabilities to model many-to-many relationships. The graph relationships are integrated into [!INCLUDE[tsql-md](../../includes/tsql-md.md)] and receive the benefits of using [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] as the foundational database management system.
20+
[!INCLUDE [sqlserver2017-asdb-asdbmi-fabricsqldb](../../includes/applies-to-version/sqlserver2017-asdb-asdbmi-fabricsqldb.md)]
21+
22+
[!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] offers graph database capabilities to model many-to-many relationships. The graph relationships are integrated into [!INCLUDE [tsql-md](../../includes/tsql-md.md)] and receive the benefits of using [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] as the foundational database management system.
2123

2224
## What is a graph database?
2325

24-
A graph database is a collection of nodes (or vertices) and edges (or relationships). A node represents an entity (for example, a person or an organization) and an edge represents a relationship between the two nodes that it connects (for example, likes or friends). Both nodes and edges may have properties associated with them. Here are some features that make a graph database unique:
26+
A [graph database](/fabric/graph/graph-database) is a collection of nodes (or vertices) and edges (or relationships). A node represents an entity (for example, a person or an organization) and an edge represents a relationship between the two nodes that it connects (for example, likes or friends). Both nodes and edges might have properties associated with them. Here are some features that make a graph database unique:
2527

26-
- Edges or relationships are first class entities in a Graph Database and can have attributes or properties associated with them.
27-
- A single edge can flexibly connect multiple nodes in a Graph Database.
28-
- You can express pattern matching and multi-hop navigation queries easily.
29-
- You can express transitive closure and polymorphic queries easily.
28+
- Edges or relationships are first class entities in a Graph Database and can have attributes or properties associated with them.
29+
- A single edge can flexibly connect multiple nodes in a Graph Database.
30+
- You can express pattern matching and multi-hop navigation queries easily.
31+
- You can express transitive closure and polymorphic queries easily.
3032

3133
## When to use a graph database
3234

33-
A relational database can achieve anything a graph database can. However, a graph database makes it easier to express certain kinds of queries. Also, with specific optimizations, certain queries may perform better. Your decision to choose either a relational or graph database is based on following factors:
35+
A relational database can achieve anything a graph database can. However, a graph database makes it easier to express certain kinds of queries. Also, with specific optimizations, certain queries might perform better. Your decision to choose either a relational or graph database is based on following factors:
36+
37+
- Your application has hierarchical data. The **HierarchyID** data type can be used to implement hierarchies, but it has some limitations. For example, it doesn't allow you to store multiple parents for a node.
3438

35-
- Your application has hierarchical data. The HierarchyID datatype can be used to implement hierarchies, but it has some limitations. For example, it doesn't allow you to store multiple parents for a node.
36-
- Your application has complex many-to-many relationships; as application evolves, new relationships are added.
37-
- You need to analyze interconnected data and relationships.
39+
- Your application has complex many-to-many relationships; as application evolves, new relationships are added.
3840

39-
## Graph features introduced in [!INCLUDE[sssql17](../../includes/sssql17-md.md)]
41+
- You need to analyze interconnected data and relationships.
4042

41-
The following features were introduced in SQL Server 2017.
43+
## Graph features introduced in SQL Server 2017
44+
45+
The following features were introduced in [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)].
4246

4347
### Create graph objects
4448

45-
[!INCLUDE[tsql-md](../../includes/tsql-md.md)] extensions allow users to create node or edge tables. Both nodes and edges can have properties associated to them. Since, nodes and edges are stored as tables, all the operations that are supported on relational tables are supported on node or edge table. Here's an example:
49+
[!INCLUDE [tsql-md](../../includes/tsql-md.md)] extensions allow users to create node or edge tables. Both nodes and edges can have properties associated to them. Since, nodes and edges are stored as tables, all the operations that are supported on relational tables are supported on node or edge table. Here's an example:
4650

4751
```sql
48-
CREATE TABLE Person (ID INTEGER PRIMARY KEY, Name VARCHAR(100), Age INT) AS NODE;
49-
CREATE TABLE friends (StartDate date) AS EDGE;
50-
```
52+
CREATE TABLE Person
53+
(
54+
ID INT PRIMARY KEY,
55+
Name VARCHAR (100),
56+
Age INT
57+
) AS NODE;
58+
CREATE TABLE friends
59+
(
60+
StartDate DATE
61+
) AS EDGE;
62+
```
5163

5264
The following diagram shows how Nodes and Edges are stored as tables.
5365

54-
:::image type="content" source="media/sql-graph-overview/person-friends-tables.png" alt-text="Diagram showing the Nodes and Edges are stored as tables.":::
66+
:::image type="content" source="media/sql-graph-overview/person-friends-tables.png" alt-text="Diagram showing the Nodes and Edges are stored as tables." lightbox="media/sql-graph-overview/person-friends-tables.png":::
5567

5668
### Query language extensions
5769

58-
New `MATCH` clause is introduced to support pattern matching and multi-hop navigation through the graph. The `MATCH` function uses ASCII-art style syntax for pattern matching. For example, to find friends of "John":
70+
New `MATCH` clause is introduced to support pattern matching and multi-hop navigation through the graph. The `MATCH` function uses ASCII-art style syntax for pattern matching. For example, to find friends of "John":
5971

6072
```sql
6173
-- Find friends of John
62-
SELECT Person2.Name
63-
FROM Person Person1, Friends, Person Person2
74+
SELECT Person2.Name
75+
FROM Person AS Person1, Friends, Person AS Person2
6476
WHERE MATCH(Person1-(Friends)->Person2)
65-
AND Person1.Name = 'John';
77+
AND Person1.Name = 'John';
6678
```
6779

68-
### Fully integrated in [!INCLUDE [ssde](../../includes/ssdenoversion-md.md)]
80+
### Fully integrated in SQL Server Database Engine
6981

70-
Graph extensions are fully integrated in [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] engine. Use the same storage engine, metadata, query processor, etc. to store and query graph data. Query across graph and relational data in a single query. Combining graph capabilities with other [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] technologies like columnstore indexes, HA, R services, etc. SQL graph also supports all the security and compliance features available with [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
82+
Graph extensions are fully integrated in [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] engine. Use the same storage engine, metadata, query processor, etc. to store and query graph data. Query across graph and relational data in a single query. Combining graph capabilities with other [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] technologies like columnstore indexes, HA, R services, etc. SQL graph also supports all the security and compliance features available with [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)].
7183

7284
### Tooling and ecosystem
7385

74-
Benefit from existing tools and ecosystem that [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] offers. Tools like backup and restore, import and export, BCP just work out of the box. Other tools or services like SSIS, SSRS, or Power BI work with graph tables, just the way they work with relational tables.
86+
Benefit from existing tools and ecosystem that [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] offers. Tools like backup and restore, import and export, and **bcp** just work out of the box. Other tools or services like [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] [!INCLUDE [ssisnoversion-md](../../includes/ssisnoversion-md.md)], [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] [!INCLUDE [ssrsnoversion-md](../../includes/ssrsnoversion-md.md)], or Power BI work with graph tables, just the way they work with relational tables.
7587

7688
## Edge constraints
7789

78-
An edge constraint is defined on a graph edge table and is a pair of node table(s) that a given edge type can connect. Edge constraints help developers restrict the type of nodes that a given edge can connect.
90+
An edge constraint is defined on a graph edge table and is a pair of node tables that a given edge type can connect. Edge constraints help developers restrict the type of nodes that a given edge can connect.
7991

80-
To learn more about how to create and use edge constraints, refer to [Edge Constraints](../../relational-databases/tables/graph-edge-constraints.md).
92+
To learn more about how to create and use edge constraints, refer to [Edge constraints](../tables/graph-edge-constraints.md).
8193

8294
## Merge DML
8395

84-
The [MERGE](../../t-sql/statements/merge-transact-sql.md) statement performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in a target table based on differences between the target table and the source table. Using MATCH predicates in a MERGE statement is now supported on Azure SQL Database and SQL Server vNext. That is, it's now possible to merge your current graph data (node or edge tables) with new data using the MATCH predicates to specify graph relationships in a single statement, instead of separate INSERT/UPDATE/DELETE statements.
96+
The [MERGE](../../t-sql/statements/merge-transact-sql.md) statement performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in a target table based on differences between the target table and the source table. Using `MATCH` predicates in a `MERGE` statement is now supported on Azure SQL Database and SQL Server vNext. That is, it's now possible to merge your current graph data (node or edge tables) with new data using the `MATCH` predicates to specify graph relationships in a single statement, instead of separate `INSERT`, `UPDATE`, and `DELETE` statements.
8597

86-
To learn more about how match can be used in merge DML, refer to [MERGE Statement](../../t-sql/statements/merge-transact-sql.md).
98+
To learn more about how match can be used in merge DML, refer to [MERGE](../../t-sql/statements/merge-transact-sql.md).
8799

88100
## Shortest path
89101

90-
The [SHORTEST_PATH](./sql-graph-shortest-path.md) function finds shortest path between any two nodes in a graph or starting from a given node to all the other nodes in the graph. `SHORTEST PATH` can also be used to find a transitive closure or for arbitrary length traversals in the graph.
102+
The [SHORTEST_PATH](sql-graph-shortest-path.md) function finds shortest path between any two nodes in a graph or starting from a given node to all the other nodes in the graph. `SHORTEST PATH` can also be used to find a transitive closure or for arbitrary length traversals in the graph.
91103

92104
## Fabric SQL database
93105

94-
In Fabric SQL database, SQL Graph is allowed, but Node and Edge tables will not mirror to Fabric OneLake.
106+
In Fabric SQL database, SQL Graph is allowed, but Node and Edge tables don't mirror to Fabric OneLake.
95107

96108
## Related content
97109

98-
- Read the [SQL Graph Database - Architecture](./sql-graph-architecture.md)
99-
- To get started with SQL Graph, see [SQL Graph Database - Sample](./sql-graph-sample.md)
110+
- [SQL Graph Architecture](sql-graph-architecture.md)
111+
- [Create a graph database and run some pattern matching queries using T-SQL](sql-graph-sample.md)

0 commit comments

Comments
 (0)