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

Re: Best way to construct PostgreSQL ArrayType (_int4) from C int array

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Adrian Schreyer <ams214(at)cam(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Best way to construct PostgreSQL ArrayType (_int4) from C int array
Date: 2011-04-27 17:06:01
Message-ID: BANLkTi=qYY9gdR+S2VAZAq028TEQyywmVw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
On Wed, Apr 27, 2011 at 12:00 PM, Adrian Schreyer <ams214(at)cam(dot)ac(dot)uk> wrote:
> The largest arrays I expect at the moment are more or less sparse
> vectors of around 4.8k elements and I have noticed that the
> input/output (C/C++ extension) does not scale well with the number of
> elements in the array.
>
> Using a function that sums all elements in the array, this is the time
> it takes for ~150k arrays of various sizes (including ordering desc
> and limit 10):
>
> 128: 61ms
> 256: 80ms
> 512: 681ms
> 1024 1065ms
> 2048 7682ms
> 4096 21332ms

hm, I'm not following you exactly -- what sql are you running?  This
scales pretty well for me:
select array_dims(array(select generate_series(1,1000000)));
etc

merlin

In response to

Responses

pgsql-general by date

Next:From: Tom LaneDate: 2011-04-27 17:36:25
Subject: Re: timestamp(0) vs. timestamp
Previous:From: Thomas HaroldDate: 2011-04-27 17:01:16
Subject: Re: PHP and PostgreSQL 9.0, pg_connect fails to connect

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