Hi
It seems like client side library manager would be sort of option.
Possibly with components like:
  1. library storage (central? some sort of source control system, e.g. Mercurial?)
  2. merger - would take "live" XQuery and merge in any function from library, which seems appropriate
    1. real time one - having libraries somewhere at hand and inserting them there
      1. If you would use REST access to BaseX, it could be implemented at web server as filter
      2. Or as I use Python API, I would modify the library to intercept any XQuery command, and enhance the XQuery content at this place.
    2. preprocessing way - building final XQuery once at the moment source code is written and before it is run multiple times
Just some ideas.

Jan

2010/12/29 Charles F. Munat <charles.munat@gmail.com>
Good to know. I'm not worried about performance that much. I'm sure I can optimize the query(s) once I get them all figured out. What would have made the ability to store functions nice is that there are many that are reused in different queries, so currently I have to have multiple copies. Then if I make a change, I have to remember to make it to all of them. Not a big deal, just a matter of efficiency. But I can work around this on my end by storing the functions in one spot and then just inserting them programatically as necessary into the query.

When I get to optimizing, I will gladly take advantage of your offer. Huib has already given me some good ideas.

Chas.


On 12/29/2010 7:08 AM, Michael Seiferle wrote:
Hi Chas,
(and hi  Huib),

thanks for your input!

At the moment preloading&  compiling queries ahead of time is not possible.
The main reason for this is that, from our experience, queries are usually rather short and cheap to compile.

Providing an infrastructure that takes care of precompiled queries might present quite a challenge, yet it should not be impossible.

You two probably knew this, but it might be of interest to the list as well,  there's a very basic benchmark mechanism:

SET RUNS N
Now every query you issue is run N-times, including parsing&  compiling. You will get average duration values for each step, if you enable the query info view.

This is not representative, but on my machine the 40KB functx library [1] takes an avg of ~13ms to parse and ~7ms to compile,
so the overhead introduced by reparsing/recompiling should be rather low in general.

In case you experience particular problems with specific queries feel free to contact us.
Often tweaking the query a little, such that possible index optimizations are recognized correctly by our compiler will speed up queries considerably.

I hope this helps, feel free to ask for more! Feedback is very welcome :-)

Kind regards
Michael


Am 29.12.2010 um 07:40 schrieb Charles F. Munat:

The other question I had was if it was possible to pre-load the embedded database with the functions, rather than having to load them all at the time the xquery is run. Sort of the way functions or triggers are preloaded into an RDBMS. Do you happen to know if that's possible?
[1] http://www.xqueryfunctions.com/xq/download.html
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



--
Ing. Jan Vlčinský
CAD programy
Slunečnicová 338/3, 734 01 Karviná Ráj, Czech Republic
tel: +420-597 602 024; mob: +420-608 979 040
skype: janvlcinsky; GoogleTalk: jan.vlcinsky@gmail.com
http://cz.linkedin.com/in/vlcinsky