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

Joe Wicentowski joewiz at gmail.com
Sun May 8 09:20:57 PDT 2011


Hi Andrew,

> 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?

In the case of eXist, eXist by default creates an index for @xml:id
values, which it uses to resolve calls to fn:id(), so you don't need
to define an extra range index on @xml:id if you're only using
fn:id().  However, if you are making a general comparison, i.e.
//node[@xml:id = 'abc'], then defining an additional range index will
speed up your query.  For a bit more on this (including attributes
defined as ID in a DTD), see the "Database Tuning" article
http://exist-db.org/tuning.html#N10382.

Cheers,
Joe



More information about the talk mailing list