Re: Where to count - Mailing list pgsql-general

From Mitch Vincent
Subject Re: Where to count
Date
Msg-id 00af01c151c9$3669e330$1e51000a@mitch
Whole thread Raw
In response to Where to count  ("H. Wade Minter" <minter@lunenburg.org>)
Responses Re: Where to count
List pgsql-general
If you use LIMIT, count(*) is going to return that limit even if there are
more than the specified limit.

Why are you going a LIMIT here if it's the count you're looking for?


----- Original Message -----
From: "H. Wade Minter" <minter@lunenburg.org>
To: <pgsql-general@postgresql.org>
Sent: Wednesday, October 10, 2001 3:46 PM
Subject: [GENERAL] Where to count


> I'm running a DB query on a database of firewall log entries (right now
> around 700k rows).  What I want to do is pull out some common entries, as
> well as the number of times that they occur in the table.
>
> Right now, I'm doing a query like:
>
> select source,destination,service,count(*) FROM logs WHERE action='$type'
> GROUP BY source,destination,service ORDER BY count DESC LIMIT $num;
>
> This is a little more advanced than I'm used to doing, so I'm wondering if
> that query is the best way to get that data, or if there's another way of
> doing it.
>
> Thanks,
> Wade
>
> --
> Do your part in the fight against injustice.
> Free Dmitry Sklyarov!  http://www.freesklyarov.org/
> Fight the DMCA!  http://www.anti-dmca.org/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: Performance problem with 50,000,000 rows
Next
From: Alvar Freude
Date:
Subject: Re: PG mailing list problems (was Re: Support issues)