release read lock
Thursday, 16 August 2018 · 5 messages · last reply 17 Aug 2018
ВВ
Ветошкин Владимир16 Aug 2018 11:44 #
Hi!
Is there a way to cache data and release read lock ?
I have to get some data from DB and then make some actions with it, that takes a long time. I would like to release lock after getting data from the DB.
--
С уважением,
Ветошкин Владимир Владимирович
CG
Christian Grün17 Aug 2018 08:25 #
Hi Владимир,
Databases will stay opened until the full query has been evaluated. One of the reasons is that it’s not trivial to detect when the last relevant read operation will take place in a query.
Could you share your query with us (or relevant parts of it)?
Best,
Christian
Quoted text · Ветошкин Владимир · 11 lines
On Thu, Aug 16, 2018 at 11:44 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > Hi! > > Is there a way to cache data and release read lock ? > I have to get some data from DB and then make some actions with it, that takes a long time. I would like to release lock after getting data from the DB. > > -- > С уважением, > Ветошкин Владимир Владимирович >
ВВ
Ветошкин Владимир17 Aug 2018 10:31 #
Hi, Christian!
That is the similar query I sent you in previous letters (where first query is to database e.g. 'sirukov' and then some queries to several bases).
Have you experience with basex in high-load projects?
I fear that I'm wrong in choosing basex as a database for storaging xml-data, because the project must be scalable and in prospect it would be multiuser (about 1000 users or more). Every day there will be many xml-files loading to server.
I have a decision to make - continue working with basex or look for another solution.
Quoted text · Christian Grün · 25 lines
17.08.2018, 09:25, "Christian Grün" <christian.gruen at gmail.com>: > Hi Владимир, > > Databases will stay opened until the full query has been evaluated. > One of the reasons is that it’s not trivial to detect when the last > relevant read operation will take place in a query. > > Could you share your query with us (or relevant parts of it)? > > Best, > Christian > > > > On Thu, Aug 16, 2018 at 11:44 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > > Hi! > > > > Is there a way to cache data and release read lock ? > > I have to get some data from DB and then make some actions with it, that takes a long time. I would like to release lock after getting data from the DB. > > > > -- > > С уважением, > > Ветошкин Владимир Владимирович > >
--
С уважением,
Ветошкин Владимир Владимирович
CG
Christian Grün17 Aug 2018 11:27 #
Hi Владимир,
Quoted text · Ветошкин Владимир · 1 line
> Have you experience with basex in high-load projects?
There are definitely many high-load instances of BaseX in productive use (one I’m currently working on has >100.000 read and write requests per day.
Quoted text · Ветошкин Владимир · 1 line
> That is the similar query I sent you in previous letters (where first query is to database e.g. 'sirukov' and then some queries to several bases).
Could you please forward it again?
Quoted text · Ветошкин Владимир · 1 line
> I have a decision to make - continue working with basex or look for another solution.
But it helps to regard BaseX as a framework for XML processing, rather as a monolithic database: You may need to write parts of the database application logic in XQuery to get full performance (create
incremental databases for new data, auxiliary index database for fast queries, etc.). So you may need to decide how much time you want to spend in coding XQuery.
Christian
Quoted text · Ветошкин Владимир · 39 lines
> I fear that I'm wrong in choosing basex as a database for storaging xml-data, because the project must be scalable and in prospect it would be multiuser (about 1000 users or more). > Every day there will be many xml-files loading to server. > > > 17.08.2018, 09:25, "Christian Grün" <christian.gruen at gmail.com>: > > Hi Владимир, > > Databases will stay opened until the full query has been evaluated. > One of the reasons is that it’s not trivial to detect when the last > relevant read operation will take place in a query. > > Could you share your query with us (or relevant parts of it)? > > Best, > Christian > > > > On Thu, Aug 16, 2018 at 11:44 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > > > Hi! > > Is there a way to cache data and release read lock ? > I have to get some data from DB and then make some actions with it, that takes a long time. I would like to release lock after getting data from the DB. > > -- > С уважением, > Ветошкин Владимир Владимирович > > > > > -- > С уважением, > Ветошкин Владимир Владимирович >
CG
Christian Grün17 Aug 2018 14:25 #
Hi Владимир (cc to the list),
Quoted text · Christian Grün · 6 lines
> let $docs := db:open('sirukov')/docs/doc > for $msg in db:open('sirukov')/msgs/msg[EnvelopeID = $docs/envelopeid] > let $db := try {db:open($msg/dbname)} catch * {} > for $xml in $db[*:Envelope/*:Header/*:RoutingInf/*:EnvelopeID = $msg/EnvelopeID] > (: some actions with $xml and then return map data :) > return $xml
Thanks. So you’d like to close the single databases after you have processed them in you inner loop, right? That’s not possible indeed, I’m sorry (because it might happen that your database would need to be opened twice – and due to the functional nature of XQuery, the database, and its contents, must be the same throughout the query).
I know too less about your data (the number of databases, their size) and the evaluation times of your query, but you could try to use the enforceindex pragma [1] to enforce index rewritings.
Best,
Christian
[1] http://docs.basex.org/wiki/XQuery_Extensions#Database_Pragmas
Written for BaseX 9.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery