Re: Some questions about the array. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Some questions about the array.
Date
Msg-id 4475.1450836903@sss.pgh.pa.us
Whole thread Raw
In response to Re: Some questions about the array.  (Yury Zhuravlev <u.zhuravlev@postgrespro.ru>)
Responses Re: Some questions about the array.
List pgsql-hackers
Yury Zhuravlev <u.zhuravlev@postgrespro.ru> writes:
> New patch version in attachment.  

I've committed this with a number of revisions, mostly but not entirely
cosmetic.  Worthy of note:

* I did not like the way you were inserting the replacement subscript
values:

+            arrays = (AnyArrayType *)DatumGetArrayTypeP(array_source);
+            indexexpr = AARR_LBOUND(arrays)[i] + AARR_DIMS(arrays)[i] - 1;

If the source array is toasted, this causes an extra detoast operation
for *each* omitted subscript.  That could be pretty high overhead for
a large array.  The best way to avoid that is to postpone the actual
substitution of the replacement subscript values into array_get_slice
and array_set_slice; which complicates their APIs a bit more, but those
were pretty long argument lists already.

* Having done that, there was no very good reason for the blanket
prohibition on using omitted subscripts in the slice-set case.  We only
really need to fail if we're constructing the array from scratch, when
we don't have any existing subscript limits to substitute.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Possible marginally-incompatible change to array subscripting
Next
From: Tatsuo Ishii
Date:
Subject: pgbench --latency-limit option