Re: [bdbxml] Cross Query Performance Issues

John Snelson <[email protected]> Tue, 21 Feb 2006 10:16:36 +0000
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
Deepak Jois wrote:
>>>- In any case, why does the first query take a disproportionately long
>>>time as to not return even within an hour, when the second query which
>>>seems equivalent returns almost instantaneously.
>>
>>This puzzled me for a while. My current corollary from looking at the
>>query plan for the two queries is that it is to do with the size of the
>>expressions on either side of the "=" operator. Can you try this query,
>>and see if it is even faster:
>>
>>for $x in collection("enzyme.dbxml")/gnv_enzyme_pathway/
>>   db_entry[contains(enzyme_description,"cyclase")]/
>>   swissprot_reference_list/reference/@swissprot_accession_number
>>for $z in collection("upt_swissprot.dbxml")/uniprot/
>>   entry[accession = $x]
>>return ($z/name, $z/accession)
>>
>>If this is faster, then that may support my idea of what is going on.
> 
> Yes it is faster, and works for both keywords "Aristolochene" and
> "cyclase" ! Now could you please backtrack and explain to me what it
> is that you are trying to say when you write ''the size of the
> expressions on either side of the '=' operator".

What I mean is, I guess, the complexity of the expressions either side 
of the "=" operator. So in your original query it was:

$x/db_entry/swissprot_reference_list/reference/@swissprot_accession_number

which is a large query, but in the new faster query it is:

$x

which is very simple. The rule of thumb is to keep the parameters to 
comparison operators as simple as possible.

This is because the embedded query plans in the query, which will 
re-evaluate these expressions each time they are run. I will have to 
look into how we can remove this problem from the query optimizer in 
future releases.

John

-- 
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com

Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml


------------------------------------------
To remove yourself from this list, send an
email to [email protected]