X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 877435380B for ; Sat, 9 Apr 2005 16:00:31 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99285-06 for ; Sat, 9 Apr 2005 15:00:27 +0000 (GMT) Received: from a2s1.a2webhosting.com (host-180.a2webhosting.com [69.39.89.180]) by svr1.postgresql.org (Postfix) with ESMTP id 431395339E for ; Sat, 9 Apr 2005 16:00:26 +0100 (BST) Received: from user-11207sg.dsl.mindspring.com ([66.32.31.144] helo=[192.168.1.10]) by a2s1.a2webhosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) id 1DKHRe-0008UY-LG; Sat, 09 Apr 2005 11:00:22 -0400 In-Reply-To: <004b01c53c72$5e4c6390$797ba8c0@jfradkin> References: <004b01c53c72$5e4c6390$797ba8c0@jfradkin> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <177B93D9-A908-11D9-92FA-000A95B03262@pgedit.com> Content-Transfer-Encoding: 7bit Cc: "'Bob Henkel'" , "'Scott Marlowe'" , "'Andrew Sullivan'" , "'Tom Lane'" , From: John DeSoi Subject: Re: getting count for a specific querry Date: Sat, 9 Apr 2005 11:00:20 -0400 To: "Joel Fradkin" X-Mailer: Apple Mail (2.619) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s1.a2webhosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/132 X-Sequence-Number: 21025 On Apr 8, 2005, at 3:37 PM, Joel Fradkin wrote: > I don't think my clients would like me to aprox as it is a count of > their > records. What I plan on doing assuming I can get all my other problems > fixed > (as mentioned I am going to try and get paid help to see if I goofed > it up > some where) is make the count a button, so they don't wait everytime, > but > can choose to wait if need be, maybe I can store the last count with a > count > on day for the generic search it defaults to, and just have them do a > count > on demand if they have a specific query. Our screens have several > criteria > fields in each application. Here is an interface idea I'm working on for displaying query results in PostgreSQL. Maybe it will work for you if your connection method does not prevent you from using cursors. I create a cursor an then fetch the first 1000 rows. The status display has 4 paging buttons, something like this: |< < rows 1 - 1000 of ? > >| The user can hit the "next" button to get the next 1000. If less than 1000 are fetched the ? is replaced with the actual count. They can press the "last" button to move to the end of the cursor and get the actual count if they need it. So here the initial query should be fast, the user can get the count if they need it, and you don't have to re-query using limit and offset. The problem I'm looking into now (which I just posted on the general list) is I don't see a way to get the table and column information from a cursor. If I fetch from a cursor, the table OID and column number values are 0 in the row description. If I execute the same query directly without a cursor, the row description has the correct values for table OID and column number. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL