Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xml storage model in yukon

0 views
Skip to first unread message

Alex Shirshov

unread,
Apr 6, 2004, 4:55:03 AM4/6/04
to
Hello, All!

I wonder, why new xml data type in Yukon internally stored as nvarchar(max).
I don't know for sure, but here http://www.itwriting.com/sqlyukon2.php
Garden sad, that they use SAX to navigate through xml document to make the
update.
<q>
We're using SAX-based technology to run through the entire document, and
find the place where you want to insert or change even one character in the
document.
</q>
Full-text search capability on xml data type column corroborate this.

It is not good for queries: the processor have to build data model each time
it runs the query. I think, it will be better to use PDOM or similar
persistent data model.

Another question is how the system build xml index on xml document, which
internally is text? Does it contain all text values for all nodes or only
attribute values? Does it index xml structure to quickly finds parent-child
relationships and descendant nodes?

With best regards, Alex Shirshov.


Roger Wolter[MSFT]

unread,
Apr 6, 2004, 10:40:46 AM4/6/04
to
This shows the shortcomongs of having someone who doesn't work on the XML
Team explain how XML works. A few minor corrections:
XML is stored in a binary format
XML is indexed down to the element and attribute level
With an index you can search for values, paths, etc. without parsing the
XML.
If there's an index we can go directly to the element you want to
update.
Full text search does support XML.


"Alex Shirshov" <nom...@mail.ru> wrote in message
news:eaYWbT7G...@tk2msftngp13.phx.gbl...

Alex Shirshov

unread,
Apr 8, 2004, 2:00:36 AM4/8/04
to
Hello, Roger!
You wrote on Tue, 6 Apr 2004 07:40:46 -0700:

RWM> "Alex Shirshov" <nom...@mail.ru> wrote in message
RWM> This shows the shortcomongs of having someone who doesn't work on the
XML
RWM> Team explain how XML works. A few minor corrections:
RWM> XML is stored in a binary format

What do you mean? XML is a text and where is no advantage to convert it to
the binary format. Maybe xml document tree after parsing saved in data pages
in binary format? In that case all links beteew nodes must be relative. But
this approach is very inefficient!
I look at data in the pages via dbcc page and find that xml stores in linear
(childs after parent, following after childs) format! It also not so good,
'cause there are many numeric schemas to track xml structure, what has
better performance.

RWM> XML is indexed down to the element and attribute level

It seems so, 'cause it eats very much space. In my test with 3.6Kb xml
document, the index occupy 6 pages! Maybe you explain how it works and what
is
pk1, id, nid, tid, value, lvalue, lvaluebin, hid, xsinil, xsitype?

RWM> With an index you can search for values, paths, etc. without
RWM> parsing the
RWM> XML.

Parsing for what? It is already in binary format! :)

RWM> If there's an index we can go directly to the element you want to
RWM> update.

What do you mean I can? This optional?

RWM> Full text search does support XML.

No doubt! I just want to know how it works. :)

[Sorry, skipped]

Michael Rys [MSFT]

unread,
Apr 8, 2004, 5:42:54 PM4/8/04
to
The XML datatype is parsed and then stored in an internal binary format that
provides more efficient storage and represents the type annotated
information set (aka as the XQuery data model) in a binary stream.

This format is then transformed into a node table format when you perform
queries over them. The node table can be persisted as the primary XML index
on the column, so it is already there. That nodetable provides for very
efficient processing of path expressions for example. The columns you refer
to below are the column of that node table.

Fulltext works by using the normal fulltext index DDL. That identifies that
the column is of type XML and uses the built-in XML IFilter that will index
the element content (not attribute values).

Best regards
Michael

"Alex Shirshov" <nom...@mail.ru> wrote in message

news:uaHrV7SH...@TK2MSFTNGP12.phx.gbl...

Alex Shirshov

unread,
Apr 16, 2004, 2:47:02 AM4/16/04
to
Hello, Michael!
You wrote on Thu, 8 Apr 2004 14:42:54 -0700:


Thank you very much, Michael! Now it is clear for me.

[Sorry, skipped]

Well, some more question.
Schemas. Why you don't support annotations and key and unique elements? It
isn't hard to implement from my point of view. Also, can you tell me how to
drop existing schema? I can't do what even there is no xml column in any
table within database which refer to it.

Query. What is namespace bounded to sql prefix for sql:variable or
sql:column functions? I definitely can say, that the name of this functions
is qualified, 'cause I cann't use any namespace with sql prefix in query,
which uses sql:variable for instance.

Michael Rys [MSFT]

unread,
Apr 16, 2004, 4:30:00 AM4/16/04
to
We do not preserve annotations, since we currently only map validation
relevant information into our meta data. If you want to preserve them, just
load them into an XML typed column.

Regarding key/keyref and unique: key/keyref requires an XPath 1.0 engine for
the validator, which we decided not to implement in this release given our
benefit/cost analysis. If there are enough customer requests to have them
added, they will in an upcoming release.

The namepsace bound to sql will be documented (don't have it handy right
now).

Best regards
Michael

"Alex Shirshov" <nom...@mail.ru> wrote in message

news:uCDHh63I...@TK2MSFTNGP11.phx.gbl...

Alex Shirshov

unread,
Apr 16, 2004, 10:55:02 AM4/16/04
to
Hello, Michael!
You wrote on Fri, 16 Apr 2004 01:30:00 -0700:


[Sorry, skipped]


Why is empty sequence treat as scalar value? For example, in this case there
is error
declare @xml xml
set @xml='<a/>'
set @xml::modify('delete if true() then () else /*')

Instead of this a have to write something like
set @xml::modify('delete if true() then ../ else /*')

Of course, in the real application in place of true() function will be real
condition.

Does XQuery engine support any type of comment? It seems to me, it doesn't
support standard syntax, which is (: :).

And you not answered about dropping schema
[q]
How can I drop existing schema? I can't do what even there is no xml column


in any
table within database which refer to it.

[/q]

drop xmlschema just doesn't work, although the output is the command
completed successfully!

Michael Rys [MSFT]

unread,
Apr 18, 2004, 2:22:41 PM4/18/04
to
Your query below errors because of a syntax error. Once you write

declare @xml xml
set @xml='<a/>'

set @xml::modify('delete if (true()) then () else /*')

You will see that it works...

Re comment syntax. The syntax is still based on an older syntax proposal.
You need to write {-- --} for now.

You should be able to drop a schema and it seems to work on my current
build. Do you get an error message or is it just not doing it? Is the schema
referred to by another schema?

Thanks
Michael

"Alex Shirshov" <nom...@mail.ru> wrote in message

news:OullNL8I...@TK2MSFTNGP11.phx.gbl...

Alex Shirshov

unread,
Apr 19, 2004, 11:06:34 AM4/19/04
to
Hello, Michael!
You wrote on Sun, 18 Apr 2004 11:22:41 -0700:

MRM> Your query below errors because of a syntax error. Once you write

MRM> declare @xml xml
MRM> set @xml='<a/>'
MRM> set @xml::modify('delete if (true()) then () else /*')

MRM> You will see that it works...

Hm...
I get "XQuery: Expression after 'delete' cannot return a scalar value." like
in the original example.
I have Microsoft SQL Server Yukon - 9.00.608 (Intel X86).

MRM> Re comment syntax. The syntax is still based on an older syntax
MRM> proposal. You need to write {-- --} for now.

Ok.

MRM> You should be able to drop a schema and it seems to work on my current
MRM> build. Do you get an error message or is it just not doing it?

No. All clear.

MRM> Is the schema referred to by another schema?

No.


Michael Rys [MSFT]

unread,
Apr 26, 2004, 9:51:27 PM4/26/04
to
I am running it in a newer build and it works without an error message.
Looks like a bug that got fixed.

Thanks
Michael

"Alex Shirshov" <nom...@mail.ru> wrote in message

news:eKQCq$hJEHA...@TK2MSFTNGP09.phx.gbl...

0 new messages