Re: [bdbxml] Indexing attributes

Peter Hickman <[email protected]>
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
John Snelson wrote:

> What indexes have you tried? I suggest adding a 
> "node-attribute-equality-string" index on "id".
>
Pretty much

addIndex "" id node-attribute-equality-decimal

Plus a few other variants on a theme.

> What are the documents like in your database. If you only have one 
> larger document, then indexes do not currently make much of a 
> difference (they should in a forthcoming version). We currently 
> suggest that people split larger documents up into several smaller 
> documents, to get the best performance from DB XML.

There are four source documents at the collection element level ranging 
from 148K to 5M. The structure is the same in all the documents.

collection / book / chapter / paragraph / line with an id attribute on 
all the elements except line and a number attribute on book, chapter and 
paragraph.

> Could it be that your paragraphs are always numbered (with @number) in 
> document order? If so, then you can leave off the "order by" clause, 
> as this is probably the main reason for the query being slow right now.

Problem is that the data is not necessarily in the correct order. I am 
thinking of writing an XSLT to reorder the documents before feeding them 
into the database.

I tested a version of the query without the order by clause and the 
saving was 6 ms (yes milliseconds).

However changing from

createContainer books.dbxml d novalidate

to

createContainer books.dbxml in novalidate

has reduced the query time by an order or magnitude, and the removal of 
the order by clause has saved another 37 ms.

> I hope this helps,
>
> John
>
Thanks a lot, given me much to think about.



------------------------------------------
To remove yourself from this list, send an
email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.