From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Michael Harris <michael(dot)harris(at)ericsson(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Aggregate Function to return most common value for a column |
Date: | 2009-05-22 08:39:19 |
Message-ID: | 162867790905220139l5b3a184bjade6e514f07d4683@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
I thing, so the function in C is the best solution. And I thing, so
you can use PostgreSQL functionality inside. Pg support hash arrays
and hashing function too.
regards
Pavel Stehule
2009/5/22 Michael Harris <michael(dot)harris(at)ericsson(dot)com>:
> Hi Experts,
>
> I want to use an aggregate function that will return the most commonly
> occurring value in a column.
>
> The column consists of VARCHAR(32) values.
>
> Is it possible to construct such an aggregate using PL/PgSql ?
>
> If I was trying to do something like this in Perl I would use a hash
> table to store the values and the number of times each was seen as the
> table was iterated, but PL/PgSql does not seem to have an appropriate
> data type for that?
>
> I don't want to use PL/Perl to avoid the overhead of starting a perl
> interpreter for that.
>
> Do I have to write the function in C maybe?
>
>
> Thanks in advance,
> Regards
> Mike Harris
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ivan Sergio Borgonovo | 2009-05-22 08:41:27 | Re: Aggregate Function to return most common value for a column |
Previous Message | Michael Harris | 2009-05-22 07:48:44 | Aggregate Function to return most common value for a column |