SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure...

36
<xml> vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen <xml> und {JSON} SQL saturday #409

Transcript of SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure...

Page 1: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

<xml> vs. {JSON}

SQL Server vs. Azure DocumentDB

ein battle zwischen<xml> und {JSON}

SQL saturday #409

Page 2: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Organizer

SQLSaturday Rheinland 201513.06.2015

Page 3: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Bronze Sponsor

SQLSaturday Rheinland 201513.06.2015

Page 4: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Silver Sponsor

SQLSaturday Rheinland 201513.06.2015

Page 5: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Gold Sponsor

SQLSaturday Rheinland 201513.06.2015

Page 6: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

You rock!

SQLSaturday Rheinland 201513.06.2015

Page 7: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

About me

13.06.2015 SQLSaturday Rheinland 2015

... and „2012er“ SQL MCSE

SQL + BI Consultant

Alexander Karl

Page 8: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

About me

13.06.2015 SQLSaturday Rheinland 2015

Twitter: @SaschaDittmann

Blog: http://www.sascha-dittmann.de

Sr. Software DeveloperSr. Solutions Architect

Sascha Dittmann

Page 9: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Agenda

Setup

Tooling

Consistency

CRUD

Indexing

Schema validation <xml> only

Server side code

Complex queries and transformation <xml> only

13.06.2015 SQLSaturday Rheinland 2015

Page 10: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Setup

13.06.2015 SQLSaturday Rheinland 2015

SQL Server Setup

erfolgt mittels Wizard oder via cmd-Line

native xml Unterstützung

„out of the Box“

Page 11: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Setup

13.06.2015 SQLSaturday Rheinland 2015

Page 12: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Tooling

13.06.2015 SQLSaturday Rheinland 2015

SQL Server Management Studio

>> für queries

>> für „xml-results“

Page 13: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Tooling

13.06.2015 SQLSaturday Rheinland 2015

Page 14: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Tooling

13.06.2015 SQLSaturday Rheinland 2015

Page 15: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Tooling

13.06.2015 SQLSaturday Rheinland 2015

Page 16: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Consistency (ACID)

13.06.2015 SQLSaturday Rheinland 2015

A tomicity

C onsistency

I solation

D urabilty

Page 17: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Consistency (BASE)

13.06.2015 SQLSaturday Rheinland 2015

B asically

A vailable

S oft state

E ventual consistency

Page 18: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Select & Ins/Upd/Del

13.06.2015 SQLSaturday Rheinland 2015

T-SQL conformer Ins/Upd/Del

T-SQL XQuery <column>.query ( return xml )

<column>.value ( return sql-Type )

<column>.exist ( return bit )

<column>.nodes

Page 19: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Select & Ins/Upd/Del

13.06.2015 SQLSaturday Rheinland 2015

T-SQL Xquery Navigation im <xml> child

descendant

parent

Attribut

self

descendant-or-self

.node()

.text()

Page 20: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

CRUD Samples

13.06.2015 SQLSaturday Rheinland 2015

Page 21: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Select & Ins/Upd/Del

13.06.2015 SQLSaturday Rheinland 2015

LINQ, SQL

REST API over HTTPS

.NET

Node.js

JavaScript

Python

Page 22: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

CRUD Samples

13.06.2015 SQLSaturday Rheinland 2015

Page 23: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Indexing

13.06.2015 SQLSaturday Rheinland 2015

PRIMARY XML INDEX IX_primaryXml

CREATE XML INDEX IX_name

ON sch.table ( xmlCol )

USING XML INDEX IX_primaryXml

FOR PATH;

FOR VALUE;

FOR PROPERTY;

Page 24: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Indexing

13.06.2015 SQLSaturday Rheinland 2015

Page 25: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Indexing

13.06.2015 SQLSaturday Rheinland 2015

Page 26: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Indexing Policies

13.06.2015 SQLSaturday Rheinland 2015

Page 27: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Schema Validation

13.06.2015 SQLSaturday Rheinland 2015

XML SCHEMA COLLECTION schemaName

(table) xmlColumn

xml ( DOCUMENT schemaName )

Page 28: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Schema Validation

13.06.2015 SQLSaturday Rheinland 2015

Page 29: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Schema Validation

13.06.2015 SQLSaturday Rheinland 2015

Page 30: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Schema Validation

13.06.2015 SQLSaturday Rheinland 2015

Triggers

Client-Side Code

Page 31: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

server side code

13.06.2015 SQLSaturday Rheinland 2015

Page 32: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

compl. queries & transformation

13.06.2015 SQLSaturday Rheinland 2015

XML „FLWOR“

for let where order return

Aggregat functions

{count($j)}

{sum($j)}

{avg($j)}

Page 33: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

compl. queries & transformation

13.06.2015 SQLSaturday Rheinland 2015

Page 34: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

compl. queries

13.06.2015 SQLSaturday Rheinland 2015

Page 35: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Questions

13.06.2015 SQLSaturday Rheinland 2015

???

Page 36: SQL Server vs. Azure DocumentDB ein battle zwischen und ... vs. {JSON} SQL Server vs. Azure DocumentDB ein battle zwischen  und {JSON} SQL saturday #409. Organizer

Save the date!

13.06.2015 SQLSaturday Rheinland 2015