jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Query performance for large query results
Date Mon, 27 Nov 2006 10:55:20 GMT
Hi,

The best way to solve your issue would be to somehow let the client
instruct the repository that only the first 20 results are needed.
Then there would be no need for any extra trickery.

Perhaps a Jackrabbit-specific extension (or something in JSR 283) like:

    public interface JackrabbitQuery extends Query {

        /**
         * Sets the maximum size of the result set returned
         * when this query is executed.
         */
        void setLimit(long limit);

    }

Note that this would still only improve performance when result set
ordering is disabled.

On 11/27/06, Christoph Kiehl <kiehl@subshell.com> wrote:
> 1. Use a lazy QueryResultImpl that keeps a reference to the result and only
> fetches the UUIDs for requested nodes.

I much prefer this approach over adding yet another cache. :-)

> This imposes that the access check is done in the QueryResultImpl and the
> result size returned by size() may vary if you don't have access to some nodes
> (which it already does if node in the result gets deleted).

We could postpone the size calculation; if getSize() is never called,
there is no need to calculate the result in advance. Additionally or
instead of making getSize() lazy, we could add a configuration
variable that governs the accuracy of the return value:

1) Return -1, this is allowed by the spec, but not very useful
2) Return the (almost) correct size like now, but with the latency issue
3) Return the unfiltered size, reducing latency but compromising security
4) Return the correct size for result sets of up to N nodes, otherwise return -1

> The real problem is how to trigger result.close() which closes the index. I'm even
> not sure if it causes problems if indexes are not closed as fast as possible.

Any Lucene experts around with more insight on this?

BR,

Jukka Zitting

Mime
View raw message