Where to count - Mailing list pgsql-general

From H. Wade Minter
Subject Where to count
Date
Msg-id 20011010154342.Y11015-100000@bunning.skiltech.com
Whole thread Raw
List pgsql-general
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/


pgsql-general by date:

Previous
From: sanjay.dixit@nebula.ie
Date:
Subject: Problem : Pound to Hash sign
Next
From: David Link
Date:
Subject: Performance problem with 50,000,000 rows