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 1t0EBG-00A8O4-FA for pgsql-docs@arkaria.postgresql.org; Mon, 14 Oct 2024 06:03:47 +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 1t0EBE-00AGfB-LK for pgsql-docs@arkaria.postgresql.org; Mon, 14 Oct 2024 06:03:45 +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 1t0EBE-00AGee-9d for pgsql-docs@lists.postgresql.org; Mon, 14 Oct 2024 06:03:44 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0EBB-000mpc-5z for pgsql-docs@lists.postgresql.org; Mon, 14 Oct 2024 06:03:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1728885817; bh=VeVZ2TBOMwBbdnPsPF1rdBMSobexLLGshq9+GWViDGM=; h=Message-ID:Date:User-Agent:To:From:Subject:From; b=yMvtYdFHgTP+0xN79tfX756hI+dvnj9+2ltDSTiBuXq6xEcq/RYFROKihvNML7MXt Z0jnuAjzJSgAozHYnnpPi86J3XVIG+j5mrMdZkxm5mrHDZmcZIx7kjdWPWfiJlaZy0 xxwncxE8W8llCNgwabggWOIJpowgsm7Z7DatQXODX0FsWqTm1cCKIv89jP1bgsvMnX 3LPBjk8Hf++8cwBK3U7shfW6UCI0d3Wfi5Rd8UZeF505HHnc6+KfoMf0YaQc0a8iCR YO8OrLmNoRZwFkHsnh4SsPYKSQm5PxX1DWSKBRPVromBa12Z3mnUUptECWkxhzxwYP LCyikqygsYEtA== Received: from [172.30.32.170] (unknown [172.30.32.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: e.kiryanova@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 8C3DB6013E for ; Mon, 14 Oct 2024 09:03:37 +0300 (MSK) Content-Type: multipart/mixed; boundary="------------ZUTxBFJHQpyuN6JEN6p3xMy7" Message-ID: <440403b2-5c91-45a8-88c9-db031f05ef4d@postgrespro.ru> Date: Mon, 14 Oct 2024 09:03:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: pgsql-docs@lists.postgresql.org From: Ekaterina Kiryanova Subject: Limitation relates to memory allocation X-KSMG-AntiPhishing: NotDetected, bases: 2024/10/14 03:43:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/10/14 04:27:00 #26749654 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------ZUTxBFJHQpyuN6JEN6p3xMy7 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello! 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? -- Ekaterina Kiryanova Technical Writer Postgres Professional the Russian PostgreSQL Company --------------ZUTxBFJHQpyuN6JEN6p3xMy7 Content-Type: text/x-patch; charset=UTF-8; name="palloc-limitation.patch" Content-Disposition: attachment; filename="palloc-limitation.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2RvYy9zcmMvc2dtbC9saW1pdHMuc2dtbCBiL2RvYy9zcmMvc2dtbC9s aW1pdHMuc2dtbAppbmRleCBmMjZmNDQ2NjcxOS4uODljMzgzZDFkYjcgMTAwNjQ0Ci0tLSBh L2RvYy9zcmMvc2dtbC9saW1pdHMuc2dtbAorKysgYi9kb2Mvc3JjL3NnbWwvbGltaXRzLnNn bWwKQEAgLTcxLDcgKzcxLDggQEAKICAgICA8cm93PgogICAgICA8ZW50cnk+ZmllbGQgc2l6 ZTwvZW50cnk+CiAgICAgIDxlbnRyeT4xIEdCPC9lbnRyeT4KLSAgICAgPGVudHJ5PjwvZW50 cnk+CisgICAgIDxlbnRyeT5saW1pdGVkIGJ5IDxmdW5jdGlvbj5wYWxsb2MoKTwvZnVuY3Rp b24+IHJlc3RyaWN0aW9uOyBzZWUgbm90ZQorICAgICBiZWxvdzwvZW50cnk+CiAgICAgPC9y b3c+CiAKICAgICA8cm93PgpAQCAtMTQ2LDQgKzE0NywxNCBAQAogICBUeXBpY2FsbHksIHRo aXMgaXMgb25seSBhbiBpc3N1ZSBmb3IgdGFibGVzIGNvbnRhaW5pbmcgbWFueSB0ZXJhYnl0 ZXMKICAgb2YgZGF0YTsgcGFydGl0aW9uaW5nIGlzIGEgcG9zc2libGUgd29ya2Fyb3VuZC4K ICA8L3BhcmE+CisKKyA8cGFyYT4KKyAgVGhlIDEgR0IgZmllbGQgc2l6ZSBsaW1pdCBpcyBp bXBvc2VkIGJ5IHRoZSBtZW1vcnktY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