Enjoy Every Sandwich

Thoughts on SQL, XML, .NET and sometimes beer.

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


Navigation

Tools

List O'Links

Kent's Other Stuff

Subscriptions

News

Please read these
Notices and Disclamiers

Post Categories

Article Categories



Friday, June 10, 2005 - Posts

DAT384: Together at last: Combining XML and Relational Data in SQL Server 2005

Well, session #2 of the show for me, and I’m front-row center 10 minutes early today. Dr. Michael Rys is presenting. Room was nice and full. Cabana following at 10:45. Cool!

 

  • Talked about the engine to file system barriers between data
  • XML in the database is good because you get a good data management story
  • Talked about XML is
  • Presented the three-type model of Structured, Semi-Structured and Markup data; document ordering and schema and extensible by design.
  • Multiple schema can be thought of as late-binding, where as the normal relational model is a priori
  • Talked about Relational Data as high structured and easily related
  • Talked about use cases as Data Exchange, Document Management (consider it as data vs. presentation separation), Messaging, mid-tier collaboration and ad-hoc modeling (think about config files, etc.)
  • Transport, Store and Query XML
  • “First normal form is vastly overrated.” Wow
  • 5 to 10 years will still see that XML and Relational mapping is the most important feature, with type replacing that slowly.
  • XML as type provides
    • Concurrency control
    • Recovery
    • Reshaping
    • Query
    • Update
    • Engine
    • Optimized queries
  • You can use XML for anything, but it’s probably better to use relational store today for some performance. Use Relational for flat, structured data. Hierarchial Data is pick’em/choose’em. Aggregation over sub-elements is probably faster over relational data. But addresses – or data where you are querying single values is probably better in XML if you already have it in XML. Recursion data is probably also pick’em.
  • Use XML and relational together of course.
  • Nice chart of use cases for XML vs. Relational and when to use what
  • Covered the list of features of SQL Server 2000
  • Nice XML Architecture XML diagram
    • Step 1 is parsing, can be a fragment.
    • Step 2 is storing a binary XML (think varbinary(max), there is some name and namespace tokenization)
      • Note that Schema collection is still available
    • Step 3 is supporting query, which builds a node table and that gets used in queries.
    • Note that OpenXML and .nodes() to yield rowsets
  • Demo of using XML as type using, ironically, contact data.
    • Use single_blob to preserve encoding
  • Showed reading a schema from a file and populating a schema collection, as well as how to fetch you the schema
  • The binary store format is first and format parsing and serialization to be efficient. Talked about UTF-16.
  • Talked about sizing of Indexing as 2x for primary or .5 for secondary of size of XML data. Eg. 100k doc as a 200k primary XML index and a 50k secondary XML
  • Two phase query model
    • Parsing is static, and uses schema for
    • Algebrazation of the XQuery and SQL query plans into a plan tree
    • Talk about execution of the plan tree
  • Showed demo of the XML type methods and reshapings
  • Interesting XQuery where clause of “where some $s in $c//saleslead satisfies string($s) = ‘snoozies’”
  • July 2004 is the cutoff for XQuery working drafts
  • Can’t use in Sql:Column,Sql:Variable for CLRUDTS, datetimes and XML.
  • Talked about use cases for secondary use cases
  • OpenXML for legacy apps, use nodes() otherwise.
  • Talked about SIS as an XML pump
  • Examples of shredding with nodes()
  • FOR XML EXPLICIT – “I lovingly call it the query from hell”
  • Showed a couple of nice demos of FOR XML PATH and nesting them. Then showed the FOR XML EXPLICIT version of it.
  • Talked about the need to preserve SQL 2000 compat and changes in for XML
  • OpenXML is based on MSXML 3.0 engine and parsing is scaling better

posted Friday, June 10, 2005 8:07 AM by ktegels

TechEd Geek Stat of the Week

As seen on CommNet...

Feeding the Masses - what does it take to feed 13,000 people at Tech·Ed?

  • 117,000 bottles of water
  • 14,300 lattes
  • 15,600 ice cream bars (it’s HOT out there)
  • 4,000 pounds of chips and snack mix
  • 2,300 dozen eggs
  • 8,000 pounds of chicken
  • 52,000 servings of juice

posted Friday, June 10, 2005 7:59 AM by ktegels




Powered by Dot Net Junkies, by Telligent Systems