BaseX performance

Saturday, 20 October 2012 · 3 messages · last reply 21 Oct 2012
CH
Christopher Harper20 Oct 2012 13:58 #
Hi @ll, I'm working on an CM/DM solution that uses BaseX as the metadata repository. This isn't my first stab at a DM/CM system just that the XML database portion is new to me Now when trying to scale the system up I find that I have created at least one offending query:
count(
distinct-values(
let $item := doc('db')/repository/items/*//object
for $path in $item/paths/path
where starts-with($path/@name, '/Root/Temp/Import/')
return $item/@uuid
)
)
The '*/' could be replaced with 'documents/document' and 'folders', but that would be two separate queries and their individual times would still be offending. The goal of the query is to list items placed into a certain folder structure represented by items in the database. This seems like a straight forward query but I'm stumped at trying to get it to perform adequately. Any suggestions? / Chris
AW
Andreas Weiler21 Oct 2012 12:24 #
Hi Chris, probably the index:facets function [1] is a solution for you. The number of distinct-values for each facet depends on the maxcat setting [2]. Note: if the content of your database changes you have to recreate the index. Kind regards, Andreas [1] http://docs.basex.org/wiki/Index_Module#index:facets [2] http://docs.basex.org/wiki/Options#MAXCATS
Quoted text · Christopher Harper · 29 lines
Am 20.10.2012 um 13:58 schrieb Christopher Harper: > Hi @ll, > > I'm working on an CM/DM solution that uses BaseX as the metadata repository. This isn't my first stab at a DM/CM system just that the XML database portion is new to me… > > Now when trying to scale the system up I find that I have created at least one offending query: > > count( > distinct-values( > let $item := doc('db')/repository/items/*//object > for $path in $item/paths/path > where starts-with($path/@name, '/Root/Temp/Import/') > return $item/@uuid > ) > ) > > The '*/' could be replaced with 'documents/document' and 'folders', but that would be two separate queries and their individual times would still be offending. > > The goal of the query is to list items placed into a certain folder structure represented by items in the database. > > This seems like a straight forward query but I'm stumped at trying to get it to perform adequately. > > Any suggestions? > > / Chris > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CH
Christopher Harper21 Oct 2012 23:24 #
Thanks Andreas, Executed index:facets("db") After which the offending query and the results din't improve significantly (As it stands doc('db')/repository/items/*// 12500 object elements). I have now selected to only count the direct descendants of a folder with
count(distinct-values(for $item in doc('db')/repository/items/*//object
where $item/paths/path[@uuid='028c2c53-a0fb-4611-bec5-62a33321a026']
return $item/@uuid))
and it performs all right. / Chris
Quoted text · Andreas Weiler · 57 lines
From: Andreas Weiler <andreas.weiler at uni-konstanz.de> Date: Sunday, 21 October 2012 13:24 To: Christopher Harper <christopher at sardion.fi> Cc: <basex-talk at mailman.uni-konstanz.de> Subject: Re: [basex-talk] BaseX performance > Hi Chris, > > probably the index:facets function [1] is a solution for you. > The number of distinct-values for each facet depends on the maxcat setting > [2]. > > Note: if the content of your database changes you have to recreate the index. > > Kind regards, > Andreas > > [1] http://docs.basex.org/wiki/Index_Module#index:facets > [2] http://docs.basex.org/wiki/Options#MAXCATS > > Am 20.10.2012 um 13:58 schrieb Christopher Harper: > >> Hi @ll, >> >> I'm working on an CM/DM solution that uses BaseX as the metadata repository. >> This isn't my first stab at a DM/CM system just that the XML database portion >> is new to me >> >> Now when trying to scale the system up I find that I have created at least >> one offending query: >> >> count( >> distinct-values( >> let $item := doc('db')/repository/items/*//object >> for $path in $item/paths/path >> where starts-with($path/@name, '/Root/Temp/Import/') >> return $item/@uuid >> ) >> ) >> >> The '*/' could be replaced with 'documents/document' and 'folders', but that >> would be two separate queries and their individual times would still be >> offending. >> >> The goal of the query is to list items placed into a certain folder structure >> represented by items in the database. >> >> This seems like a straight forward query but I'm stumped at trying to get it >> to perform adequately. >> >> Any suggestions? >> >> / Chris >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery