Skip site navigation (1) Skip section navigation (2)

Integer aggregate and enum

From: mlw <markw(at)mohawksoft(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Integer aggregate and enum
Date: 2001-12-21 00:53:10
Message-ID: 3C2287F6.B29D2A32@mohawksoft.com (view raw or flat)
Thread:
Lists: pgsql-hackers
I wrote two functions I think are quite cool.

int_aggregate_array(int)
and
int_enum_array(int[])


While I'm not sure I can submit them because I wrote them on company
time, I thought I should tell you about them because they are fairly
trivial, and could make postgresql better.

They are used as:

create table test select id1, int_aggregate_array(id2) as ar group by
id1;

This creates a summary table. It is used as:

select id1, int_enum_array(ar) from test where id1 = 'nnnnn';


If you have a "one to many" table the "int_aggregate_array" will reduce
it to one row with an array. The int_enum_array() is used to extract it.

The idea is that a multiple  a -> b records could be encoded as one row.
This could be a huge performance improvement.

pgsql-hackers by date

Next:From: Tatsuo IshiiDate: 2001-12-21 01:44:59
Subject: Re: SunOS patch for memcmp()
Previous:From: Mikheev, VadimDate: 2001-12-21 00:03:58
Subject: Re: TOAST performance (was Re: [GENERAL] Delete Perform

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group