--
Michael Seiferle
Sent from my mobile, sorry for the brevity.
On Thursday, 3. May 2012 at 20:07, koch@buit-solutions.com wrote:
>
>
>
> Hi,
>
> I'm currently testing baseX and wondering how one should use databases/collections.
Basically databases in BaseX are either a collection (more than one doc) or made of single documents.
>
>
> I did some testing with the live demo and Query 6:
> > for $pub in doc('dblp')/dblp/*
> > where $pub/author = 'Alexander Holupirek'
> > return $pub/title
>
> First I was wondering where "in collection" is. Tried it on my local testmachine with "in collection" and several other of my testdocuments in the same collection/database and the query took more than 10 seconds compared to 100ms in the live demo!
Performance depends on many circumstances, usually we are trying to optimize queries to use indices automatically; but sometimes this may not be smart enough ;-)
You could try to compare the query plans, (info view in the GUI) for doc vs collection. Index accesses are denoted in the plan.
Have you made sure that the indices are up to date and enabled? This can be found in file>database properties, iirc
Another option to force index access is the db:fulltext() function,
http://docs.basex.org/wiki/Database_Module#db:fulltext
>
>
> Then I found out that you don't need "in collection" if you have just one document in the database. So I dropped all other documents and tried it again: This time the query took 38ms!
> Is this intended or am I doing something wrong? When should you use collections/databases?
In case this problem persists feel free to send a ssce example to support@basex.org, we'll have a look then!
>
>
> Are there any hints or best practices how to organize data to get efficient queries?
Thats a tough question and depends a lot on the actual data being stored, but most often query rewrites can offer execution times an order of a magnitude better :-)
>
> Krind regards,
>
> Stefan
Hope this already helps a little
Michael
>
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
>
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>
>