Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0y7x-00E2fV-Ff for pgsql-docs@arkaria.postgresql.org; Wed, 16 Oct 2024 07:07:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t0y7v-00H4DT-Lk for pgsql-docs@arkaria.postgresql.org; Wed, 16 Oct 2024 07:07:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0y7v-00H4Co-E6 for pgsql-docs@lists.postgresql.org; Wed, 16 Oct 2024 07:07:23 +0000 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0y7p-0018ZU-1U for pgsql-docs@lists.postgresql.org; Wed, 16 Oct 2024 07:07:22 +0000 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 1BBD7138015C; Wed, 16 Oct 2024 03:07:16 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Wed, 16 Oct 2024 03:07:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1729062436; x=1729148836; bh=h9/pbPZj1raLZEPi5wHTtCQ/gC0YX41CQgZxrhlZt0k=; b= d5FOTzOL1w+a/PrpxTjlUllTeDDUYFgj4H2on226irCfWk9lYdAf94vMDc+zvBqY Ft5Dwpt04pcEC+MSSO4s98gKbKgIBxDB5nxk8YDPg6QGH9V5XfgAEzAu0V4TnsiO NMbNR4WSNBGA1lq44Gpy4OpttAsW7bwCsB0yTbGQEuYwoNABTN9T/KwM72yiN4+K yXiCTCR6bmBXfvnrWr+acqhysDVpBu2eX6K2Mo+DBu8Lo4+zj/7RHp2f+CoXIYAa MphWxlBXFm8RruoYVHHymrXHq7/m5p4Pe/K4HcoG+fI5OiJRwnhHIDNs4esEkyIp 1/K+Z0VAkDU4KyF0yoLH0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1729062436; x= 1729148836; bh=h9/pbPZj1raLZEPi5wHTtCQ/gC0YX41CQgZxrhlZt0k=; b=M 9YCHyGKOm9gMD4OtjGzY/K/TgzWzvIdKde8IauEv0DP9cIGHaVmOPFOGD6TPI1GA deVXf2MMRcJ7dm6JhWGHscSa7KljGW2PtNg+zk8fEdrZbHkJy6ToUJTDn8rqf1ZH sORna7KKcnoj8Yyyrp0aGR850mrUXreQLrFsCRP3s3/EuDIc9ECkOYv+DJdW2sOk vU6fUDF9PhKBGU/EzLKseuFzWGJZjIJFccFhlcQCVYTRPpNZ3G/XbJbFue7FOgdR sR5jRiqtbmrcfm8tFPVk3Csw8yyIeq5ZMtOGoKofl3RzuROucHmqOakL2iblsA40 Tj5sNDEUsx4/m6k86jrGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegkedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvihhsvg hnthhrrghuthdrohhrgheqnecuggftrfgrthhtvghrnhepgeeuuedvhfehueeijeetgfdu tdfhveevfeeugfdtvdfgteetheejteeluedvvedunecuffhomhgrihhnpehpohhsthhgrh gvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdpnhgspghrtghpthhtoh epvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvgdrkhhirhihrghnohhvrges phhoshhtghhrvghsphhrohdrrhhupdhrtghpthhtohepphhgshhqlhdqughotghssehlih hsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Oct 2024 03:07:14 -0400 (EDT) Message-ID: <80e8ac9e-da2a-4d3e-8345-d16c77ac88f9@eisentraut.org> Date: Wed, 16 Oct 2024 09:07:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Limitation relates to memory allocation To: Ekaterina Kiryanova , pgsql-docs@lists.postgresql.org References: <440403b2-5c91-45a8-88c9-db031f05ef4d@postgrespro.ru> Content-Language: en-US From: Peter Eisentraut In-Reply-To: <440403b2-5c91-45a8-88c9-db031f05ef4d@postgrespro.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 14.10.24 08:03, Ekaterina Kiryanova wrote: > We encountered an issue related to internal memory allocation limit: > ERROR: invalid memory alloc request size > > In the documentation on limits: https://www.postgresql.org/docs/17/ > limits.html > the description suggests that only a single field is limited to 1GB, > which could imply that the total tuple size can be larger. So as we > planned to store three columns of 1GB each in a table and attempted to > insert this data, we got the error. > > Our research showed that the limit is imposed by the palloc() function, > regardless of whether it is a tuple or not, and if the data is > serialized or dumped, the effective limit can be even lower, typically > around 512MB per row. So for allocations exceeding 1GB, the > palloc_extended() function can be used. Please correct me if I'm wrong. > > I prepared a small patch for master, if it's worth clarifying, could you > please review the attachment? The 1 GB limit in palloc() is a safety check, when the code shouldn't be allocating more than that. Code that legitimately wants to allocate more than 1 GB can use the MCXT_ALLOC_HUGE flag. If you see this error, then that could either be corruption somewhere (the kind of thing this safety check is meant to catch) or the code is buggy. In either case, I don't know that it is appropriate to document this as an externally visible system limitation.