[xquery-talk] A Suitable Database for Good XQuery Performance
rpbourret at rpbourret.com
Wed Jan 9 23:20:44 PST 2008
Wei, Alice J. wrote:
> Hi, XQuery experts:
> I am not sure if anyone of you have tried to design a
> search engine (not full-text search, but like general search
> with different fields that take different variables from the
> XML documents) with XQuery to extract data.
This is a reasonable thing to do.
> Since my data is not used for full-text based search, the
> maximum number of rows it would bring back does not exceed
> over 5000 rows in any case. Using strictly XQuery for this
> particular purpose to extract XML data, is it really a fact
> that the use of XML native database be the most effective?
Yes. The reasons are:
1) The documents are parsed when they are inserted into the database, so
there is no need to parse them at query time.
2) Some or all data is indexed at insert time, which speeds up the search.
> The second question, if the answer to the first is yes,
> how would I actually call up the collections in the database?
You use the fn:collection() function. This accepts a URI and returns the
sequence of nodes in the collection. In a native XML database, this
would usually be the document nodes of the documents in the collection.
The format of the URI and exactly what nodes are returned is
For example, suppose I have a collection of Book documents that describe
individual books (title, author, publisher, etc.). I could use the
following query to retrieve the titles of the books in the collection in
for $doc in fn:collection("mydatabase:bookcollection")
order by $doc/Book/Title
> In this case, if my XML native database application is using eXist?
See the eXist documentation for the format of URIs accepted by the
fn:collection() function and a description of what is returned.
More information about the talk