[MonetDB-users] SQL exception during query resolving. Slow join? How to submit external variables?

Hi everyone, I'm new to MonetDB XQuery and have written a crude Cocoon generator for MonetDB using the example code for the JDBC client from the website. I am using the latest Bug Fix Release of MonetDB as announced by Sjoerd Mullender on 24-10-2007. When I execute the following query I get an error: --------------------------------------------------------- let $zz := doc('vogels.xml')//Vogels[data(Dwaalgast) = 'zeer zeldzaam'] return <vogeltjes>{$zz}</vogeltjes> --------------------------------------------------------- throws: java.sql.SQLException: ERROR: ERROR: XML Generation: NULL BAT has a 4415 head, but tail is NULL. ERROR: ERROR: xquery_print_result_loop: operation failed. However, when I change the XQuery to: --------------------------------------------------------- let $zz := doc('vogels.xml')//Vogels[data(Dwaalgast) = 'zeer zeldzaam'] return <vogeltjes>{$zz}azaz</vogeltjes> --------------------------------------------------------- everything's OK and I get the proper result. (The previous release threw the same error btw.) Also, when I join the results from the above query with another table to resolve some codes to code-descriptions, the query takes from 8.5 up to 11 seconds to execute, vs. <1 second for a query without the join. The result is a little over 1Mb in size. The query I use is this: --------------------------------------------------------- let $zz := doc('vogels.xml')//Vogels[Ecotoop_x0020_nest] return <vogeltjes> {for $vogel in doc('vogels.xml')//Vogels[Ecotoop_x0020_nest], $vc in doc('vogels-code.xml')//Vogels-code[data(Kolomnaam) = 'Ecotoop nest'][data(Code) = $vogel/Ecotoop_x0020_nest]/Codebeschrijving return <vogel> {$vogel/*} {$vc} </vogel> } </vogeltjes> --------------------------------------------------------- The latest preview release of eXist handles the join in 3.1 seconds, any ideas on why this join takes almost three times as long? I have a final question: how do I specify external variables using the JDBC client? Regards, Huib Verweij.

Hi Huib, to reproduce and investigate your problems, it would be very helpful for us if you could provide us with (access to) (scaled-down versions of) your documents (how big are they originally?) on which the problems (still) occur for you. Stefan On Tue, Nov 27, 2007 at 10:53:43AM +0100, Huib Verweij wrote:
Hi everyone,
I'm new to MonetDB XQuery and have written a crude Cocoon generator for MonetDB using the example code for the JDBC client from the website.
I am using the latest Bug Fix Release of MonetDB as announced by Sjoerd Mullender on 24-10-2007. When I execute the following query I get an error:
--------------------------------------------------------- let $zz := doc('vogels.xml')//Vogels[data(Dwaalgast) = 'zeer zeldzaam']
return <vogeltjes>{$zz}</vogeltjes> ---------------------------------------------------------
throws:
java.sql.SQLException: ERROR: ERROR: XML Generation: NULL BAT has a 4415 head, but tail is NULL. ERROR: ERROR: xquery_print_result_loop: operation failed.
However, when I change the XQuery to:
--------------------------------------------------------- let $zz := doc('vogels.xml')//Vogels[data(Dwaalgast) = 'zeer zeldzaam']
return <vogeltjes>{$zz}azaz</vogeltjes> ---------------------------------------------------------
everything's OK and I get the proper result. (The previous release threw the same error btw.)
Also, when I join the results from the above query with another table to resolve some codes to code-descriptions, the query takes from 8.5 up to 11 seconds to execute, vs. <1 second for a query without the join. The result is a little over 1Mb in size. The query I use is this:
--------------------------------------------------------- let $zz := doc('vogels.xml')//Vogels[Ecotoop_x0020_nest]
return <vogeltjes> {for $vogel in doc('vogels.xml')//Vogels[Ecotoop_x0020_nest], $vc in doc('vogels-code.xml')//Vogels-code[data(Kolomnaam) = 'Ecotoop nest'][data(Code) = $vogel/Ecotoop_x0020_nest]/Codebeschrijving return <vogel> {$vogel/*} {$vc} </vogel> } </vogeltjes> ---------------------------------------------------------
The latest preview release of eXist handles the join in 3.1 seconds, any ideas on why this join takes almost three times as long?
I have a final question: how do I specify external variables using the JDBC client?
Regards,
Huib Verweij.
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |

Hi Stefan, thank you for your response. Stefan Manegold schreef:
to reproduce and investigate your problems, it would be very helpful for us if you could provide us with (access to) (scaled-down versions of) your documents (how big are they originally?) on which the problems (still) occur for you.
Sure. The "vogels.xml" file is about 1.7Mb and is a simple MSAccess
export that looks like this:
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
generated="2007-08-01T21:11:45">
<Vogels>
<Soortnummer>000030</Soortnummer>
<Groepnummer>02</Groepnummer>
participants (2)
-
Huib Verweij
-
Stefan Manegold