Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 77338 invoked from network); 27 Oct 2008 21:58:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Oct 2008 21:58:09 -0000 Received: (qmail 57929 invoked by uid 500); 27 Oct 2008 21:58:13 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 57897 invoked by uid 500); 27 Oct 2008 21:58:13 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 57886 invoked by uid 99); 27 Oct 2008 21:58:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Oct 2008 14:58:13 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [203.217.22.128] (HELO file1.syd.nuix.com.au) (203.217.22.128) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Oct 2008 21:56:59 +0000 Received: from [192.168.222.60] (unknown [192.168.222.60]) by file1.syd.nuix.com.au (Postfix) with ESMTP id 180224A817F for ; Tue, 28 Oct 2008 08:57:38 +1100 (EST) Message-ID: <49063973.5070806@nuix.com> Date: Tue, 28 Oct 2008 08:58:11 +1100 From: Daniel Noll Organization: Nuix Pty Ltd User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Derby Discussion Subject: Re: getting first k rows from a query that satisfy some additional condition References: <49063683.2010301@nuix.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Amir Michail wrote: > It's slow with setMaxRows. Are you sure you have the correct indexes on whatever you're using for your condition? Try getting an explanation of your query to see what it's actually doing. I can confirm that the row_number() approach is slow (it's the current best workaround for the k..(2k-1) problem as far as I know) but I haven't noticed the same thing with setMaxRows. Daniel -- Daniel Noll Forensic and eDiscovery Software Senior Developer The world's most advanced Nuix email data analysis http://nuix.com/ and eDiscovery software