Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Fast Focus: SQL Server Graph Database & Processing


Published on

Short presentation on the graph database and processing support in SQL Server 2017 (plus new stuff in 2019) as presented at Live 360! SQL Live

Published in: Data & Analytics
  • Be the first to comment

  • Be the first to like this

Fast Focus: SQL Server Graph Database & Processing

  1. 1. Graph DB Support in SQL Server Karen Lopez Data Evangelist, InfoAdvisors Level: Intermediate
  2. 2. Karen López Karen has 20+ years of data an data architecture experience on large, multi-project programs. She is a frequent speaker on data modeling, data-driven methodologies and pattern data models. She wants you to love your data. 2
  3. 3. Clarifying terminology Graphs Graph Databases Graph Processing 3
  4. 4. Concepts Row Store Query Language relationships Write-Optimized Data Stories Index Nodes Tables Recursive Properties & tags matches Permissions Edges 4
  5. 5. Graph Nodes Node Node Node Node Node Node Node Node NodeNode Node 5
  6. 6. Directed / Undirected Node Node NodeNode Node Node Node NodeNode Node 6
  7. 7. What is this structure? 7
  8. 8. 8 Data Model – Hierarchy Recursive
  9. 9. 9 Data Model – Hierarchy Recursive
  10. 10. Recursive Relationships 10
  11. 11. 11
  12. 12. Graph Databases PHYSICAL ARCHITECTURE 12
  13. 13. Examples of Database Data Architectures Hybrid Model SQL Server OrientDB TripleStores Allegrograph Blazegraph Graph model Neo4J 13
  14. 14. 14 Common Themes Graph Theory Relationships Nodes & Edges Aggregations Distances Labels & Properties Low Cost “Joins” Limitations
  15. 15. Why use Graph over Relational Structures LET’S DISCUSS 15
  16. 16. Graph In SQL Server 16
  17. 17. Gremlin 17
  19. 19. Creating Nodes and Edges 19
  20. 20. 20 CREATETABLE Person (ID INTEGER PRIMARY KEY, NameVARCHAR(100), Age INT) AS NODE; CREATETABLE friends (StartDate date) AS EDGE;
  21. 21. 21 -- Find friends of John SELECT Person2.Name FROM Person Person1, Friends, Person Person2 WHERE MATCH(Person1-(Friends)->Person2) AND Person1.Name = 'John';
  22. 22. Match Function • A new MATCH function is required to support graph style pattern matching • For example, suppose in the graph example above, we want to find all my friends who like a given restaurant. • This can be done using the MATCH function and graph_search_pattern, which make use of ASCII art style arrows (-->) • Match is only inWHERE clause currently • Example: People who like a restaurant 22
  23. 23. Graph Searching Pattern matching will be supported using ASCII art style arrows (-->) The syntax for graph search pattern provided as input to MATCH function would be as follows 23
  24. 24. 24 Limitations Local or global temporary tables cannot be node or edge tables. Table types and table variables cannot be declared as a node or edge table. Node and edge tables cannot be created as system- versioned temporal tables. Node and edge tables cannot be memory optimized tables. Users cannot update the $from_id and $to_id columns of an edge using UPDATE statement. Cross database queries on graph objects are not supported.
  25. 25. 25
  26. 26. What’s coming in SQL Server 2019* •Use of derived table or view aliases in graph match queries •MERGE (upsert) •Edge Constraints • Existence checking • Direction of edge integrity 26
  27. 27. Use Cases …IF WE HAVE TIME… 27
  28. 28. Social Media Collaboration and sharing Friend of friend recommendations Discover Unique relationships Challenges • Dynamic networks can be challenging • Dense connections • Complex queries 28
  29. 29. Infrastructure Impact analysis and network planning Root-cause analysis IT infrastructure management Challenges • Highly interrelated elements • Non-linear and non-hierarchial relationships • Growing physical and virtual nodes 29
  30. 30. Fraud Detection & Forensics Detecting and Stopping Fraud Data scrutiny with data relationship analysis Challenges • Complex Data Relationships • Needs great real-time performance • Evolving and dynamic targets 30
  31. 31. Free Graph Database ebook 31
  32. 32. Your Master Data is a Graph: AreYou Ready
  33. 33. 10Tips for Data Pros 1. Understand the use cases for graph technologies 2. Evaluate/profile your data requirements for suitability for graph databases and/or graph processing 3. Understand the licensing/editions for commercial database features/products 4. ACID support varies across products.You’ll want to test your use cases. 5. Your query data stories will guide your decisions 33
  34. 34. 10+Tips for Architects 6. Test your current development tools for support 7. Test your database design/data modeling tools 8. Leverage your existing metadata/models 9. True hierarchies areVERY RARE in the real world. 10.Know the questions you have to ask about all the exceptions 11.Keep asking those questions and don’t stop at “but that’s an exception” 34
  35. 35. Karen López 35