Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aBYyg-000743-Qs for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Dec 2015 02:16:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aBYyf-0008BA-LU for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Dec 2015 02:16:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aBYxL-0006SL-8j for pgsql-hackers@postgresql.org; Wed, 23 Dec 2015 02:15:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aBYxH-0003q0-Fq for pgsql-hackers@postgresql.org; Wed, 23 Dec 2015 02:15:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tBN2F37o004476; Tue, 22 Dec 2015 21:15:03 -0500 From: Tom Lane To: Yury Zhuravlev cc: pgsql-hackers@postgresql.org Subject: Re: Some questions about the array. In-reply-to: References: <2987745.PueTkqGxbO@dinodell> <1538864.xaPm21N10Q@dinodell> <56619AB0.2070802@sigaev.ru> <2723429.ZaCixaFn1x@dinodell> <6ac195fe-b835-4d2d-8edc-11db52118cbf@postgrespro.ru> <2853.1450718923@sss.pgh.pa.us> <12549.1450797031@sss.pgh.pa.us> Comments: In-reply-to Yury Zhuravlev message dated "Tue, 22 Dec 2015 19:11:40 +0300" Date: Tue, 22 Dec 2015 21:15:03 -0500 Message-ID: <4475.1450836903@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Yury Zhuravlev 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers