Query persistence between several users

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Query persistence between several users

Jean-Christophe Kermagoret-2
Hello,
how to make queries persistent between several users ?

I have a query calculated for one user. Another user (so the http
session is useless) will run exactly the same query. How to cache the
results to avoid a recalculation ? Is there a app session or something
like that I can use ?

I'm in a REST use context.

Thanks,

--

BlueXML
Jean-Christophe Kermagoret
Directeur associé
[hidden email]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Query persistence between several users

Adam Retter-7
1) eXist has  a query caching mechanism to improve performance. This is
however transparent as it should be.

2) You could store the results to a temporary file in the eXist db and
your query could check the existance of that file. If it exists read the
result from there, if it doesnt do the calculation and store the result
to the temporary file.

On Thu, 2005-09-29 at 08:42 +0100, Jean-Christophe Kermagoret wrote:

> Hello,
> how to make queries persistent between several users ?
>
> I have a query calculated for one user. Another user (so the http
> session is useless) will run exactly the same query. How to cache the
> results to avoid a recalculation ? Is there a app session or
> something  
> like that I can use ?
>
> I'm in a REST use context.
>
> Thanks,
>
> --
>
> BlueXML
> Jean-Christophe Kermagoret
> Directeur associé
> [hidden email]
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl 
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Query persistence between several users

Jean-Baptiste Quenot-2
In reply to this post by Jean-Christophe Kermagoret-2
* Jean-Christophe Kermagoret:

> how to make queries persistent between several users ?
>
> I have  a query  calculated for one  user. Another user  (so the
> http session is useless) will run exactly the same query. How to
> cache the  results to  avoid a  recalculation ?  Is there  a app
> session or something like that I can use ?
>
> I'm in a REST use context.

If you use a recent XQueryGenerator, you can set a parameter
within the <map:generate type="xquery"> like this:

<map:parameter name="cache-validity" value="number-of-milliseconds-the-results-will-be-cached"/>
--
Jean-Baptiste Quenot
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Re: Query persistence between several users

Jean-Christophe Kermagoret-2
The problem is I don't use the xquery generator and I can't event use it
in my case.

My xquery script queries the database and displays data from 1 to 10 for
example. Next time, I want to display 11 to 20, so I just want to browse
the resultset : it is the resultset I want to cache, not the data.

Moreover, I'm in a REST use context and I don't want to use XQuery
generator.

Jean-Christophe

Jean-Baptiste Quenot a écrit :

> * Jean-Christophe Kermagoret:
>
>
>>how to make queries persistent between several users ?
>>
>>I have  a query  calculated for one  user. Another user  (so the
>>http session is useless) will run exactly the same query. How to
>>cache the  results to  avoid a  recalculation ?  Is there  a app
>>session or something like that I can use ?
>>
>>I'm in a REST use context.
>
>
> If you use a recent XQueryGenerator, you can set a parameter
> within the <map:generate type="xquery"> like this:
>
> <map:parameter name="cache-validity" value="number-of-milliseconds-the-results-will-be-cached"/>


--

BlueXML
Jean-Christophe Kermagoret
Directeur associé
[hidden email]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Re: Query persistence between several users

golgoth14@nonlimit.ch
Hi,

For your paging system, you could use the fn:subsequence() function to
get a range of nodes.
Like:
   let $startIndex := xs:integer((($pageIndex - 1) * $pageSize) + 1)
   return fn:subsequence($elements, $startIndex, $pageRange)


Stéphane

>
> Jean-Christophe Kermagoret wrote:
>
>> The problem is I don't use the xquery generator and I can't event use
>> it in my case.
>>
>> My xquery script queries the database and displays data from 1 to 10
>> for example. Next time, I want to display 11 to 20, so I just want to
>> browse the resultset : it is the resultset I want to cache, not the
>> data.
>>
>> Moreover, I'm in a REST use context and I don't want to use XQuery
>> generator.
>>
>> Jean-Christophe
>>
>> Jean-Baptiste Quenot a écrit :
>>
>>> * Jean-Christophe Kermagoret:
>>>
>>>
>>>> how to make queries persistent between several users ?
>>>>
>>>> I have  a query  calculated for one  user. Another user  (so the
>>>> http session is useless) will run exactly the same query. How to
>>>> cache the  results to  avoid a  recalculation ?  Is there  a app
>>>> session or something like that I can use ?
>>>>
>>>> I'm in a REST use context.
>>>
>>>
>>>
>>>
>>> If you use a recent XQueryGenerator, you can set a parameter
>>> within the <map:generate type="xquery"> like this:
>>>
>>> <map:parameter name="cache-validity"
>>> value="number-of-milliseconds-the-results-will-be-cached"/>
>>
>>
>>
>>
>
>



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Re: Query persistence between several users

Jean-Christophe Kermagoret-2
I agree with all your answers but what I want to do is to cache the 'for
clause' by storing results somewhere to avoid a recalculation for the
next request.

The subsequence does not avoid me to calculate again my 'for clause'.

Here is a snippet from my xquery :

        if ($recalculate eq "true") then
                let $results :=
                        for $doc in $xpath
                        order by $doc/meta/dtstart descending
                        return $doc
                return (
                        request:create-session(),
                        request:set-session-attribute("results", $results),
                        f:display($results, $start, $howmany)
                )
        else
                let $results := request:get-session-attribute("results")
                return
                f:display($results, $start, $howmany)

I can use a http session but it is not enough because all my users may
use the same query. I need something I can share between several users.

How may I do it ?

Jean-Christophe

Golgoth 14 a écrit :

> Hi,
>
> For your paging system, you could use the fn:subsequence() function to
> get a range of nodes.
> Like:
>   let $startIndex := xs:integer((($pageIndex - 1) * $pageSize) + 1)
>   return fn:subsequence($elements, $startIndex, $pageRange)
>
>
> Stéphane
>
>>
>> Jean-Christophe Kermagoret wrote:
>>
>>> The problem is I don't use the xquery generator and I can't event use
>>> it in my case.
>>>
>>> My xquery script queries the database and displays data from 1 to 10
>>> for example. Next time, I want to display 11 to 20, so I just want to
>>> browse the resultset : it is the resultset I want to cache, not the
>>> data.
>>>
>>> Moreover, I'm in a REST use context and I don't want to use XQuery
>>> generator.
>>>
>>> Jean-Christophe
>>>
>>> Jean-Baptiste Quenot a écrit :
>>>
>>>> * Jean-Christophe Kermagoret:
>>>>
>>>>
>>>>> how to make queries persistent between several users ?
>>>>>
>>>>> I have  a query  calculated for one  user. Another user  (so the
>>>>> http session is useless) will run exactly the same query. How to
>>>>> cache the  results to  avoid a  recalculation ?  Is there  a app
>>>>> session or something like that I can use ?
>>>>>
>>>>> I'm in a REST use context.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> If you use a recent XQueryGenerator, you can set a parameter
>>>> within the <map:generate type="xquery"> like this:
>>>>
>>>> <map:parameter name="cache-validity"
>>>> value="number-of-milliseconds-the-results-will-be-cached"/>
>>>
>>>
>>>
>>>
>>>
>>
>>
>


--

BlueXML
Jean-Christophe Kermagoret
Directeur associé
[hidden email]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Re: Query persistence between several users

wolfgangmm
> I agree with all your answers but what I want to do is to cache the 'for
> clause' by storing results somewhere to avoid a recalculation for the
> next request.

Basically sounds like a good idea, but as far as I see, there's no
object available from within the query that you could use for caching
data across sessions. You could create your own cache class (e.g. as a
singleton) and access it through the XQuery/Java binding. Thinking
about it, an extension module that provides the desired cache
functionality could be interesting too. It could use weak references,
timeouts etc.

Wolfgang


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open