X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id AD7449FA5E7 for ; Thu, 22 Jun 2006 13:16:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 04956-01-2 for ; Thu, 22 Jun 2006 13:15:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 6F6AA9FA68D for ; Thu, 22 Jun 2006 13:15:50 -0300 (ADT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 22 Jun 2006 09:15:47 -0700 Subject: Re: Limit vs setMaxRows issue From: Mark Lewis To: Sebastiaan van Erk Cc: Kris Jurka , pgsql-jdbc@postgresql.org In-Reply-To: <449A5654.5050208@sebster.com> References: <44990D57.9070506@sebster.com> <449A5654.5050208@sebster.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Thu, 22 Jun 2006 09:15:47 -0700 Message-Id: <1150992947.19111.200.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/92 X-Sequence-Number: 15372 > The reason I would like to see this feature (instead of adding the LIMIT > manually) is for cross database compatibility (which is the essence of > JDBC). Basically, setMaxRows is portable, LIMIT is not. Since I am part > of a team developing a cross-database application in which performance > is often important, this feature is quite important to us. Currently > postgres is slow for us on simple index queries on large data sets (1.8 > seconds for the first 100 primary keys only of a table of 43000 rows); > and unfortunately, these kinds of queries are very common in our > application. JDBC is a little too low-level to give true database independence; you can write portable queries, but you're severely restricted when it comes to functionality supported by most databases but not in a standardized way, such as limits, locking, performance hinting, sequences/serials, etc. For simple, non-performance critical apps you can mostly get away with it (as we did for a while with some of our products). But for anything more sophisticated, your application really needs a way to deal with database-specific SQL. On newer projects we use Hibernate HQL, which has been a major boon in terms of database portability and performance. -- Mark Lewis