Hi Eduard,
eXide stores the results of the most recently executed query in a
request attribute. For the source code showing this, see
https://github.com/wolfgangmm/eXide/blob/develop/controller.xql#L164-L230
and https://github.com/wolfgangmm/eXide/blob/develop/modules/session.xql#L38-L102.
The relevant functions are session:set-attribute() and
session:get-attribute(); see
http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/session#get-attribute.1
and http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/session#set-attribute.2.
eXide uses URL rewriting and MVC pipeline architecture to facilitate
storage/retrieval of these with the set-attribute action; see
http://exist-db.org/exist/apps/doc/urlrewrite.xml#D1.2.8.
Also you might find the cache module useful. It's not enabled by
default, but you can uncomment this line in your conf.xml file to
enable it: https://github.com/eXist-db/exist/blob/develop/conf.xml.tmpl#L915.
Joe
On Tue, Jun 6, 2017 at 11:00 AM, Eduard Drenth
<***@fryske-akademy.nl> wrote:
> Hi,
>
> Suppose I have a query yielding lots of results and I do this:
>
> mylib:somequery($query)[$start to $end]
>
> I want to prevent that each time first the query will be executed, then the result set will be built and after this it will be filtered.
>
> Is there a way to achieve this, or is the 'engine' smart enough to optimize?
>
> A seperate subject is that in the response I would like to see a total (which may imply executing an extra count query).
>
> In SQL you have LIMIT and OFFSET. Totals in SQL is often achieved by executing a count() query.
>
> Regards,
>
> Eduard Drenth, Software Architekt
>
> ***@fryske-akademy.nl
>
> Doelestrjitte 8
> 8911 DX Ljouwert
> +31 58 234 30 47
>
> gpg: https://sks-keyservers.net/pks/lookup?op=get&search=0x065EF82A1E02CC43
>
> ________________________________________
> From: Joe Wicentowski <***@gmail.com>
> Sent: Tuesday, June 6, 2017 3:59 PM
> To: Eduard Drenth
> Cc: exist-***@lists.sourceforge.net
> Subject: Re: [Exist-open] pagination
>
> Hi Eduard,
>
>> Does exist-db implement or promote pagination techniques or best practices?
>
> Sure, many eXist apps implement pagination of query results. Could
> you be more specific about what you have in mind?
>
> Joe