pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Wei Weng <wweng@kencast.com>
To: Koen Antonissen <Koen@Cee-Kay.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Count Total on a limited query?
Date: Wed, 16 Jan 2002 10:36:54 -0500
Message-ID: <20020116103654.0c47424a.wweng@kencast.com> (raw)
In-Reply-To: <DD782DD61CF86144BD78DDC89D3D6124083F46@gaea.home.dutchcentral.net>
References: <DD782DD61CF86144BD78DDC89D3D6124083F46@gaea.home.dutchcentral.net>
I don't think an extra count query is that much of a work to the system. A
counting on the indexed column is very fast.
On Wed, 16 Jan 2002 13:55:18 +0100
"Koen Antonissen" <Koen@Cee-Kay.net> wrote:
> Hi group,
>
> I've implemented a couple of search queries, to prevent too many results
> transferring/getting displayed I use a LIMIT. Now I would like to
> display the total numbers found on the query (discarding the limit).
>
> Is this possible in a nice manner?
> I thought up the following:
> 1. Implementing the limit system in PHP
> Con: Too much work for something this elementary
> 2. Executing an extra search query which only counts
> Con: An extra query which feels unnecessary
> 3. Using a subselect which only counts
> Con: although it gives a nice result, and isn't much work, the query
> will be executed for each record and therefore not an option.
>
>
> I hope this can be done using PostgreSQL.
>
> Thank you,
> Koen Antonissen
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
--
Wei Weng
Network Software Engineer
KenCast Inc.
view thread (2+ messages)
Message-ID: <20020116103654.0c47424a.wweng@kencast.com> Permalink: ../20020116103654.0c47424a.wweng@kencast.com/ Also on: postgresql.org/message-id/20020116103654.0c47424a.wweng@kencast.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-sql@postgresql.org Cc: wweng@kencast.com, Koen@Cee-Kay.net Subject: Re: Count Total on a limited query? In-Reply-To: <20020116103654.0c47424a.wweng@kencast.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox