Re: [bdbxml] Sort Query Performance
John Snelson <[email protected]> Wed, 24 Aug 2005 09:57:06 +0100
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <[email protected]> |
There are two issues here. First is that with or without the "order by"
clause, your query is returning nodes from every document in the
database. This will always take a while, but the response time (time
until first answer) can be sped up by using lazy evaluation.
The second is that the "order by" clause effectively detroys lazy
evaluation, because it has to gather all the answers before it can sort
them all and return them. Presently, DB XML does not use indexes to
optimise "order by" clauses - but this work is planned for the future,
and high priority.
With the next release of DB XML, the XmlContainer::lookupIndex() methods
will return their results in sorted index order. If your "order by"
clause directly corresponds to an index, it will be possible to use this
method to manufacture fast sorted results.
I hope this helps,
John
M Chaudhary wrote:
> Hello friends ,
> I am using dbxml 2.1.8 version .
> I am executing a sort query on a container with more than 10000
> documents , but the execution
> of the query is taking a lot of time(more than 15 mins).
> The query is as follows --
> 'for $i in collection("xyz.dbxml")/root/x order by $i/y[@a="abc"]/@b
> descending return $i'
>
> I have indexed the container as follows : -
>
> Index: node-attribute-equality-string for node {}:id
> Index: node-attribute-equality-string for node {}:a
> Index: node-attribute-presence-none to node: {}:b
>
> and the Xml Structure is as follows --
>
>
> ------XML structure ------
>
> <root id = "pqr" >
> <x>
> <y a="abc" b="300"> </y>
> <y a="def" b="123"> </y>
> <y a="pqr" b="432"> </y>
> ...
> ...
> </x>
> ...
> ...
> ...
> ...
> </root>
>
>
> Can you please suggest me what should I do make the query execution
> faster ?
> Thank You !
> Regards ,
> Ajinkya N
>
>
> ------------------------------------------
> To remove yourself from this list, send an
> email to [email protected]
>
--
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com
Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml
------------------------------------------
To remove yourself from this list, send an
email to [email protected]