From derby-user-return-9999-apmail-db-derby-user-archive=db.apache.org@db.apache.org Mon Oct 27 22:03:04 2008 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 81099 invoked from network); 27 Oct 2008 22:03:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Oct 2008 22:03:03 -0000 Received: (qmail 62506 invoked by uid 500); 27 Oct 2008 22:03:07 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 62472 invoked by uid 500); 27 Oct 2008 22:03:07 -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 62461 invoked by uid 99); 27 Oct 2008 22:03:07 -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 15:03:07 -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: domain of amichail@gmail.com designates 64.233.184.238 as permitted sender) Received: from [64.233.184.238] (HELO wr-out-0506.google.com) (64.233.184.238) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Oct 2008 22:01:51 +0000 Received: by wr-out-0506.google.com with SMTP id 67so615806wri.3 for ; Mon, 27 Oct 2008 15:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=ajaCXQlIccwQAebNLw6BlX4emr8j1dMVhhRdUoETwL4=; b=niQxA5CImz1Pgx0uTnUXMRRNkLgO2sbWxgy8ydDo0QQlTW66NXR2FCl45TKdPE+q+7 43/fA2nlS2yNtkgakKRYGk80q67P19+XafeXbW3tY0ryKsnAHZXaVKHOP+e3rkUrStdw UsDdrx6Kp5L3e4yBX+e/WQzw+5unpILKE1ElM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Gu3nt1i4VZQxfSxORlCNYglwI/pJ8L9vcgL8GdiltWCnE/1tDXzDgnUKb73RJODwfn N1dx3m5aVswe0hEC8g4UvlevTfbg1kPxdURpiLk9z7kSVIcIwIzWEAtvt/KMQQDgdSHR QzpLmTDOa/XlREecVfmenpHpa4Mv0/zT419oU= Received: by 10.100.136.18 with SMTP id j18mr6429007and.153.1225144950944; Mon, 27 Oct 2008 15:02:30 -0700 (PDT) Received: by 10.100.38.9 with HTTP; Mon, 27 Oct 2008 15:02:30 -0700 (PDT) Message-ID: Date: Mon, 27 Oct 2008 18:02:30 -0400 From: "Amir Michail" To: "Derby Discussion" Subject: Re: getting first k rows from a query that satisfy some additional condition In-Reply-To: <4d2670740810271459x69d6d9b6jdba6c0802d6378bd@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <49063683.2010301@nuix.com> <4d2670740810271459x69d6d9b6jdba6c0802d6378bd@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Oct 27, 2008 at 5:59 PM, Peter Ondru=9Aka wrote: > Please, post the query you are running. > There are queries where setMaxRows will not be faster, for example if you= do > GROUP BY or ORDER BY. The order is important, so I'm using order by. Amir > > On Mon, Oct 27, 2008 at 22:51, Amir Michail wrote: >> >> On Mon, Oct 27, 2008 at 5:45 PM, Daniel Noll wrote: >> > Amir Michail wrote: >> >> >> >> Hi, >> >> >> >> What is a good way for efficiently getting the first k rows from a >> >> query that also satisfy some additional condition to be determined >> >> using Java code? >> > >> > setMaxRows(int) is the standard way of doing this in JDBC, it only fal= ls >> > over if you later want to retrieve rows k..(2k-1). >> > >> > Daniel >> > >> >> It's slow with setMaxRows. >> >> Amir >> >> > >> > -- >> > Daniel Noll Forensic and eDiscovery Softwar= e >> > Senior Developer The world's most advance= d >> > Nuix email data analysi= s >> > http://nuix.com/ and eDiscovery softwar= e >> > >> >> >> >> -- >> http://chatbotgame.com >> http://numbrosia.com >> http://twitter.com/amichail > > --=20 http://chatbotgame.com http://numbrosia.com http://twitter.com/amichail