Christian,
Thanks - it does help. I was mainly wondering if it was safe to create a QueryProcessor instance and then repeatedly call execute() after making changes to context and/or variables without having to call parse() and/or compile() again, and it sounds like the answer is no (at least not yet).
Dave
-----Original Message----- From: Christian GrĂ¼n [mailto:christian.gruen@gmail.com] Sent: Tuesday, December 20, 2011 4:59 PM To: Dave Glick Cc: BaseX Subject: Re: [basex-talk] Precompiling Queries
Hi Dave,
this is still work in progress. One (of numerous other) challenge(s) is that the compilation of a particular query depends the availability of index structures and statistics of a particular database. It would be more than reasonable, though, to at least bundle all static/logical compilation steps that do not depend on the existing data (as an example, index access rewritings would have to be moved into an extra post-processing compilation step). Precompilation will even get more interesting if our module library will be growing.
Hope this helps (a little), Christian ___________________________
On Tue, Dec 20, 2011 at 10:35 PM, Dave Glick dglick@dracorp.com wrote:
Hello again,
I notice in the current sources for QueryProcessor.java that executing a query appears to be a three-stage process: parse, compile, and execute. Is it now possible to preparse and/or precompile a query before using it? If so, this raises a couple important questions:
- Does executing the query "destroy" it (will subsequent executions return the same results)?
- What can be done to the query after parsing or compiling? Can I rerun a query after changing the context? What about after adjusting the variable bindings? I notice that doing either of these in QueryProcessor does not reset the parse or compile flag...
The last time I looked at this, neither of the operations above were possible making preparsing and precompiling kind of pointless for embedded use. If this works now, it's very exciting and could save a lot of cycles in cases where a complex query needs to be repeatedly executed against different contexts or with different variables.
Thanks,
Dave
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk