SQL Server Graph Features - SQL Server to Aurora MySQL Migration Playbook
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

SQL Server Graph Features

Feature compatibility Amazon SCT / Amazon DMS automation level Amazon SCT action code index Key differences


                              One star feature compatibility


                              No automation

N/A

Feature isn’t supported. Migration will require implementing a workaround.

SQL Server Usage

SQL Server offers graph database capabilities to model many-to-many relationships. The graph relationships are integrated into Transact-SQL and receive the benefits of using SQL Server as the foundational database management system.

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:

  • Edges or relationships are first class entities in a graph database and can have attributes or properties associated with them.

  • A single edge can flexibly connect multiple nodes in a graph database.

  • You can express pattern matching and multi-hop navigation queries easily.

  • You can express transitive closure and polymorphic queries easily.

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:

  • 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.

  • Your application has complex many-to-many relationships; as application evolves, new relationships are added.

  • You need to analyze interconnected data and relationships.

SQL Server 2017 adds new graph database capabilities for modeling graph many-to-many relationships. They include a new CREATE TABLE syntax for creating node and edge tables, and the keyword MATCH for queries.

For more information, see Graph processing with SQL Server and Azure SQL Database in the SQL Server documentation.

Consider the following CREATE TABLE example:

CREATE TABLE Person (ID INTEGER PRIMARY KEY, Name VARCHAR(100), Age INT) AS NODE;

CREATE TABLE friends (StartDate date) AS EDGE;

The 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. Consider the following example:

-- Find friends of John
SELECT Person2.Name
FROM Person Person1, Friends, Person Person2
WHERE MATCH(Person1-(Friends)->Person2)
AND Person1.Name = 'John';

SQL Server 2019 adds ability to define cascaded delete actions on an edge constraint in a graph database. Edge constraints enable users to add constraints to their edge tables, thereby enforcing specific semantics and also maintaining data integrity. For more information, see Edge constraints in the SQL Server documentation.

In SQL Server 2019, graph tables have support for table and index partitioning. For more information, see Partitioned tables and indexes in the SQL Server documentation.

MySQL Usage

Currently, MySQL doesn’t provide native graph database features.