Hi Christian,
Thank you for your reply. Updated files are attached.
On 01/30/2015 04:35 PM, Christian Grün wrote:
Hi Menashè,
First of all, I wonder if your query really does what you want it to do. I noticed for example that some of the where conditions start with "$x/", while others start with "/" and some others start with no slash. Is this intentional?
I've added $x and now it takes little less: 30 sec. I haven't seen a case of no slash.
Some more comments:
- I would recommend you to avoid numeric tests in the @codeListValue
tests and use string tests instead (/@codeListValue = "7827", etc).
Done. Down to 23 sec.
- Usually, you can also get rid of the xs:dateTime() conversions,
because items of type date and time can also be compared as strings.
Done. Down to almost 19 sec. Still too much.
- I'm not sure what the predicates [*] are supposed to do in your
query. If you remove them, you will get the same results.
* means that I don't know if it's 1,2 or any other number inside the XPath, e.g. /gmd:MD_Metadata/gmd:identificationInfo/sdn:SDN_DataIdentification/gmd:descriptiveKeywords[1]/gmd:MD_Keywords/gmd:keyword[2]/sdn:SDN_ParameterDiscoveryCode/@codeListValue How can I remove *?
- In some cases, if you know that an element name is distinct, you can
get rid of all the explicit child steps and directly address the node via the descendant axis.
Thanks, but it's not relevant in my case.
So reordering the conditions for having smaller subset right from the begging isn't relevant.
Reordering shouldn't make a big difference anyway, because BaseX tries to find the cheapest index request by itself, based on the database statistics.
Great, as I expect from a good product :)
Beside that, I would be interested to hear if you get better results with BaseX 8.0 [1], because we recently spent quite some time to further improve our index rewriting rules.
Sure, I'l also try BaseX 8.0 and compare. Should I recreate the db importing the xml files for testing the improved indexing?
Hope this helps, Christian
[1] http://files.basex.org/releases/latest
On Fri, Jan 30, 2015 at 3:55 PM, Menashè Eliezer meliezer@ogs.trieste.it wrote:
Hello, I wonder if the attached query can be optimised. I'm attaching all relevant information. Basex 7.9, Debian, powerful server. This is just an example. The queries will be built based on a compilation of a search form. Any help would be appreciated. 40 seconds are not acceptable.
-- With kind regards, Menashè
-- With kind regards, Menashè