databases and live demo

Thursday, 3 May 2012 · 2 messages
K
koch3 May 2012 20:07 #
Hi, I'm currently testing baseX and wondering how one should use databases/collections. I did some testing with the live demo and Query 6:
Quoted text · 8 lines
> 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! 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? Are there any hints or best practices how to organize data to get efficient queries? Krind regards, Stefan
MS
Michael Seiferle3 May 2012 21:03 #
Hi Stefan,
-- Michael Seiferle Sent from my mobile, sorry for the brevity.
Quoted text · koch at buit-solutions.com · 7 lines
On Thursday, 3. May 2012 at 20:07, koch at 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.
Quoted text · koch · 8 lines
> > > 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
Quoted text · koch · 4 lines
> > > 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 at basex.org, we'll have a look then!
Quoted text · koch · 3 lines
> > > 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 :-)
Quoted text · koch · 4 lines
> > Krind regards, > > Stefan
Hope this already helps a little Michael
Quoted text · koch · 7 lines
> > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >

⚡Generated with XQuery