From: Mitch Vincent <mitch@venux.net>
To: pgsql-sql@postgreSQL.org
Subject: count() question
Date: Fri, 17 Dec 1999 22:56:13 -0500
Message-ID: <021101bf490b$d43b7ec0$0300000a@doot.org> (raw)
Hey guys, I'd like to thank Tom for his suggestion on the joins earlier. I
more/less knew that about the joins but had built everything up and sort of
stuck the sub-selects in there as a band-aid to fix a problem. I re-did all
the queries using nothing but joins and boy, it's a lot faster.
I have one problem though, this is a type of search engine so when I search
I can't display all the results on one screen, it has to be limited. I use
the LIMIT directive in the queries to do so. Before I had been going 2
queries, one to get the total number of results and one to just get 10 of
those results.
So my question is, is there anyway you can get the total number of results
(using count() or something) and still use the limit directive in the same
query? I tried looking at the number of result rows too but 10 (the limit)
is all I come up with.
I would really like to avoid doing 2 full queries here, if anyone has any
suggestions please let me know.
Thanks!!
-Mitch
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: mitch@venux.net
Subject: Re: count() question
In-Reply-To: <021101bf490b$d43b7ec0$0300000a@doot.org>
* 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