Re: getting count for a specific querry - Mailing list pgsql-sql

From Bob Henkel
Subject Re: getting count for a specific querry
Date
Msg-id 762e5c0504090843121e087c@mail.gmail.com
Whole thread Raw
In response to Re: getting count for a specific querry  (John DeSoi <desoi@pgedit.com>)
Responses Re: getting count for a specific querry
List pgsql-sql


On Apr 9, 2005 10:00 AM, John DeSoi <desoi@pgedit.com> wrote:

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


Oracle Forms uses a similar method as you described and it works just fine.  It will say Record 1 of ?(But I think the developer can set the amount of records cached so that if you set it to 10 and queried 5 records it would say record 1 of 5 because it would be under the cache amount.)  Forms also offers a button that say get hit count. So if you really need to know the record count you can get it without moving off the current record.

 

pgsql-sql by date:

Previous
From: John DeSoi
Date:
Subject: Re: getting count for a specific querry
Next
From: John DeSoi
Date:
Subject: Re: getting count for a specific querry