Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ibo01-0004nA-GO for pgsql-general@arkaria.postgresql.org; Mon, 02 Dec 2019 15:52:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ibnzy-0003f7-4U for pgsql-general@arkaria.postgresql.org; Mon, 02 Dec 2019 15:52:30 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1ibnzw-0003ep-2l for pgsql-general@lists.postgresql.org; Mon, 02 Dec 2019 15:52:29 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ibnzo-0001qY-90 for pgsql-general@lists.postgresql.org; Mon, 02 Dec 2019 15:52:27 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BB62F22148; Mon, 2 Dec 2019 10:52:17 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 02 Dec 2019 10:52:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=u hFryahcd7u+u8XKH7Z3FDivoSvihMZ7GJjerafEjxA=; b=qcmD8k4luIjccoIEw Y+AF9hTFakCGKCTfCxvEdyRvyBWA0kpgXiHOr/c4Mk2TCRQpGzYnkKUBYR0RphGN vzusI4FJH/GvvEny9kRkOjQy6TyfncY3h1wEgE234TMHWHudlgKTB8Qd/aRXTZ3G cujDZ+HAhLCIExS/w8tzBM761BJUzC7QezlSYe2EnvV0ZJTwSiGMZuqD0CBIXhb4 YDZ9qTR4xcZB1tfJxKk0wHSx3SkkpjE0Vz7XigXiRV9rHoTV99C7fy+G9ODxd/1i +7kTCQ8m9xaKd36Izv3LAZC+f7RNr2a0A2Rrxr2I/jwgSC8Ue+aln8wWxuJsVTiT qa7OA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=uhFryahcd7u+u8XKH7Z3FDivoSvihMZ7GJjerafEj xA=; b=kYGSJ1zsi1qkvOMMX8B8P5csPpYgCd2o5i4m5DkGDlMdmQOH+AuFXV5QD afdjALwd6Al+8TO+Mvg53T6rVRe3QELWxQdsZ9eZkvZgOz6o4iLg1RqTvBLL9+IQ RtQNeVjldMZDxA1ipE00KSk2k04qR8bKsNqdKMrN2vI16gsAERhvQG5Bg9oFRXcJ iLP8yY17jMUl9Qbrmz7bc3FdfHhcmuIpec4NZ8ceCzaa/6e47ZELeFfjkeZOdEcX iLx4eUz1PlT4clsDOb2b6BfvAQXzMIcGtaeQ1iQ1sFeOM2jxZ0dp4on+cyfKvwai Eb4VY364CAUewJUcdLck85e2/3OyA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudejhedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepudejgedrvddurdeikedrvdegfeenucfrrghrrghmpehmrghilhhfrhho mheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvg hrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.2] (174-21-68-243.tukw.qwest.net [174.21.68.243]) by mail.messagingengine.com (Postfix) with ESMTPA id 1723F30604B7; Mon, 2 Dec 2019 10:52:16 -0500 (EST) Subject: Re: slow insert speeds with bytea To: Alex O'Ree , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <1d622f91-3fdb-b5dc-7972-7f9f5eb3e5fd@aklaver.com> Date: Mon, 2 Dec 2019 07:52:16 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/1/19 9:59 AM, Alex O'Ree wrote: > Is there anything I can to increase insert speeds for bytea? Currently > running postgres 9.6.15 > > I have a few tables without a bytea and a few with bytea. There is a > large performance difference with inserts between the two. I'm inserting > a byte[] that's usually less than 1MB on content. The content itself is > actually just utf8 string data. > > For the non-bytea table, inserts can be as high as 40k rows/sec, whereas > the bytea table is closer to 4k/sec or less. > > If this is just a limitation of postgres, then that's fine but the > performance delta is so significant that i feel like i'm missing something It would help to have more information: 1) The schema of the table e.g. the output of \d in psql. 2) The actual INSERT query. 3) An EXPLAIN ANALYZE of the INSERT query. -- Adrian Klaver adrian.klaver@aklaver.com