Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 4402 invoked from network); 31 Mar 2006 15:35:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Mar 2006 15:35:33 -0000 Received: (qmail 5883 invoked by uid 500); 31 Mar 2006 15:35:27 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 5648 invoked by uid 500); 31 Mar 2006 15:35:25 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 5592 invoked by uid 99); 31 Mar 2006 15:35:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Mar 2006 07:35:23 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [128.231.90.107] (HELO nihrelayxway2.hub.nih.gov) (128.231.90.107) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Mar 2006 07:35:20 -0800 Received: from holmes.nhgri.nih.gov (HELO [128.231.145.14]) ([128.231.145.14]) by nihrelayxway2.hub.nih.gov with ESMTP; 31 Mar 2006 10:35:00 -0500 X-IronPortListener: NIH_Relay X-SBRS: None X-IronPort-AV: i="4.03,151,1141621200"; d="scan'208"; a="157577510:sNHT121591736" User-Agent: Microsoft-Entourage/11.2.3.060209 Date: Fri, 31 Mar 2006 10:34:58 -0500 Subject: Re: Database transaction across multiple web requests From: Sean Davis To: Frank Wiles , Issac Goldstand CC: , , "modperl@perl.apache.org" Message-ID: Thread-Topic: Database transaction across multiple web requests Thread-Index: AcZU2Kqw6UWCwsDLEdqrmAANkzVl6A== In-Reply-To: <20060331090126.b44ff3d0.frank@wiles.org> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On 3/31/06 10:01 AM, "Frank Wiles" wrote: > On Fri, 31 Mar 2006 14:47:37 +0200 > Issac Goldstand wrote: > >> Granted, I use a few MySQL features for this; I'm not sure if LIMIT >> exists in postgresql, and I'm fairly sure that the SQL_CALC_FOUND_ROWS >> directive (which will return the total rows in a select statement >> regardless of the LIMIT directives) doesn't... > > PostgreSQL has LIMIT... it's a SQL standard. And I don't really see > why you would need SQL_CALC_FOUND_ROWS unless you where going to > show the total number of pages. For simple Next/Previous paging > you just keep going until you fall off the end. > > If you need to get a count you can just do a count() on a particular > column without the LIMIT and get a total. In postgres, a count(*) can be fairly time-consuming, so a quick-and-dirty hack is to parse the output of the "EXPLAIN ..." query to get the estimated number of rows, which is often just fine as an estimate. If the database is vacuumed often or is basically query-only, these numbers will often be very close or the same as the real thing. Sean