[xquery-talk] Is there any point of using xml:id with an xml db?

Andrew Welch andrew.j.welch at gmail.com
Thu May 5 07:31:46 PDT 2011

On 5 May 2011 15:17, Michael Kay <mike at saxonica.com> wrote:
> On 05/05/2011 13:44, Andrew Welch wrote:
>> Hi,
>> Is there any benefit to using xml:id with an xml database, over a
>> plain old id attribute with a range index?  (lookup performance rather
>> than uniqueness checking)
>> Out of interest, if you did use xml:id and then create a range index
>> for that, which would get used?
> Well, it all rather depends on the implementation, doesn't it?

It started as a bit of a discussion on twitter about using xml:id in
xquery... and then I thought what's the point - is there any when a db
is involved?

Using Saxon on the filesystem then I guess it would be a way of
improving lookup performance by making up for the lack of keys in
xquery... (guessing again), but in a db where you have range indexes
it seems redundant.

Also fwiw, there is a gotcha in going from //@id = '123' to id('123')
as it will silently produce no output because of the NCName
restriction (using Saxon)...

Andrew Welch

More information about the talk mailing list