| From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> | 
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org | 
| Subject: | Re: Help on using hyperloglog in Postgresql | 
| Date: | 2016-10-07 13:02:43 | 
| Message-ID: | 20161007130243.GA6132@tux | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
Abdlhamed, Mohamed <M(dot)A(dot)Abdlhamed(at)2013(dot)ljmu(dot)ac(dot)uk> wrote:
> I am new to PostgreSQL and SQL. I want to apply HLL in PostgreSQL on a table
> contain traffic information each stored in separate column, so I want to
> estimate the cardinality of every distinct IP. the cardinality here is how many
> ports contacted distinct per IP. IPs stored in 'Destination' column and ports
> stored in 'DetsPort'. can anyone help me with full code and steps please!
if i understand you, you have a table with 2 columns, 'destination' and
'destport', right? And you want to know how many ports per destination
there are, right?
select 
  destination
  , count(destport) 
from <insert_the_table_name_here>
group by destination;
Regards, Andreas Kretschmer
-- 
Andreas Kretschmer
http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Binand Sethumadhavan | 2016-10-07 17:14:05 | \COPY in script | 
| Previous Message | Abdlhamed, Mohamed | 2016-10-07 09:46:33 | Help on using hyperloglog in Postgresql |