Optimized query is empty when database is open and query uses a variable

Wednesday, 14 October 2015 · 4 messages · last reply 20 Oct 2015
AG
Amanda Galtman14 Oct 2015 21:48 #
Hi, When I run the following query with BaseX 8.2.3 or 8.3, and I have a certain database open, the optimized query is empty, so there are no results.
let $x := 'x'
let $doc := <root><el attr="x;y"/></root>
return $doc//el[contains(@attr,$x)]
This seems like a bug. If I close the database (which is not even being referenced in this query), open a different database, or replace $x in the last line with the literal string value, 'x', then I get the result I expect. The database that exhibits the problem and the database that doesn't exhibit the problem differ in the kinds of XML files in them and the indexes that are available for them. Does anyone know why the open database should affect the result of a query that doesn't reference the database? Thanks, Amanda
CG
Christian Grün14 Oct 2015 21:57 #
Hi Amanda, You are completely right. It seems that the database statistics of a currently opened database are utilized to optimize the path in your query. I have added a GitHub issue [1], it should be fixed soon. Thanks, Christian [1] https://github.com/BaseXdb/basex/issues/1202
Quoted text · Amanda Galtman · 36 lines
On Wed, Oct 14, 2015 at 9:48 PM, Amanda Galtman <Amanda.Galtman at mathworks.com> wrote: > Hi, > > > > When I run the following query with BaseX 8.2.3 or 8.3, and I have a certain > database open, the optimized query is empty, so there are no results. > > > > let $x := 'x' > > let $doc := <root><el attr="x;y"/></root> > > return $doc//el[contains(@attr,$x)] > > > > This seems like a bug. If I close the database (which is not even being > referenced in this query), open a different database, or replace $x in the > last line with the literal string value, ‘x’, then I get the result I > expect. The database that exhibits the problem and the database that doesn’t > exhibit the problem differ in the kinds of XML files in them and the indexes > that are available for them. > > > > Does anyone know why the open database should affect the result of a query > that doesn’t reference the database? > > > > Thanks, > > Amanda
AG
Amanda Galtman14 Oct 2015 22:06 #
Thanks, Christian! Amanda
Quoted text · Christian Grün · 59 lines
> -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: Wednesday, October 14, 2015 3:58 PM > To: Amanda Galtman <Amanda.Galtman at mathworks.com> > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] Optimized query is empty when database is open > and query uses a variable > > Hi Amanda, > > You are completely right. It seems that the database statistics of a currently > opened database are utilized to optimize the path in your query. I have > added a GitHub issue [1], it should be fixed soon. > > Thanks, > Christian > > [1] https://github.com/BaseXdb/basex/issues/1202 > > > > > On Wed, Oct 14, 2015 at 9:48 PM, Amanda Galtman > <Amanda.Galtman at mathworks.com> wrote: > > Hi, > > > > > > > > When I run the following query with BaseX 8.2.3 or 8.3, and I have a > > certain database open, the optimized query is empty, so there are no > results. > > > > > > > > let $x := 'x' > > > > let $doc := <root><el attr="x;y"/></root> > > > > return $doc//el[contains(@attr,$x)] > > > > > > > > This seems like a bug. If I close the database (which is not even > > being referenced in this query), open a different database, or replace > > $x in the last line with the literal string value, ‘x’, then I get the > > result I expect. The database that exhibits the problem and the > > database that doesn’t exhibit the problem differ in the kinds of XML > > files in them and the indexes that are available for them. > > > > > > > > Does anyone know why the open database should affect the result of a > > query that doesn’t reference the database? > > > > > > > > Thanks, > > > > Amanda
CG
Christian Grün20 Oct 2015 12:08 #
Quoted text · Amanda Galtman · 66 lines
On Wed, Oct 14, 2015 at 10:06 PM, Amanda Galtman <Amanda.Galtman at mathworks.com> wrote: > Thanks, Christian! > > Amanda > > >> -----Original Message----- >> From: Christian Grün [mailto:christian.gruen at gmail.com] >> Sent: Wednesday, October 14, 2015 3:58 PM >> To: Amanda Galtman <Amanda.Galtman at mathworks.com> >> Cc: basex-talk at mailman.uni-konstanz.de >> Subject: Re: [basex-talk] Optimized query is empty when database is open >> and query uses a variable >> >> Hi Amanda, >> >> You are completely right. It seems that the database statistics of a currently >> opened database are utilized to optimize the path in your query. I have >> added a GitHub issue [1], it should be fixed soon. >> >> Thanks, >> Christian >> >> [1] https://github.com/BaseXdb/basex/issues/1202 >> >> >> >> >> On Wed, Oct 14, 2015 at 9:48 PM, Amanda Galtman >> <Amanda.Galtman at mathworks.com> wrote: >> > Hi, >> > >> > >> > >> > When I run the following query with BaseX 8.2.3 or 8.3, and I have a >> > certain database open, the optimized query is empty, so there are no >> results. >> > >> > >> > >> > let $x := 'x' >> > >> > let $doc := <root><el attr="x;y"/></root> >> > >> > return $doc//el[contains(@attr,$x)] >> > >> > >> > >> > This seems like a bug. If I close the database (which is not even >> > being referenced in this query), open a different database, or replace >> > $x in the last line with the literal string value, ‘x’, then I get the >> > result I expect. The database that exhibits the problem and the >> > database that doesn’t exhibit the problem differ in the kinds of XML >> > files in them and the indexes that are available for them. >> > >> > >> > >> > Does anyone know why the open database should affect the result of a >> > query that doesn’t reference the database? >> > >> > >> > >> > Thanks, >> > >> > Amanda

⚡Generated with XQuery