May be I completely wrong but I always assumed that the access speed to the
array element in PostgreSQL should be close to constant time.
But in tests I found that access speed degrade as O(N) of array size.
Test case (performed on large not busy server with 1GB work_mem to ensure I
working with memory only):
t AS (SELECT ARRAY(SELECT * FROM generate_series(1,N)) AS _array)
SELECT count((SELECT _array[i] FROM t)) FROM generate_series(1,10000) as
Results for N between 1 and 10.000.000 (used locally connected psql with
--until there all reasonable
10M 220000ms = 22ms to sinlge array element access.
Is that behaviour is correct?
PS: what I actually lookin for - constant fast access by position
tuplestore for use with recursive queries and/or pl/pgsql, but without
using C programming.
Senior Postgresql DBA.
Phone RU: +7 910 405 4718
Phone AU: +61 45 218 5678
"People problems are solved with people.
If people cannot solve the problem, try technology.
People will then wish they'd listened at the first stage."
pgsql-performance by date
|Next:||From: Kevin Grittner||Date: 2012-06-22 15:59:44|
|Subject: Re: Why is a hash join being used?|
|Previous:||From: Andy Halsall||Date: 2012-06-21 20:07:01|
|Subject: Can I do better than this heapscan and sort?|