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 1rc7il-0014E5-17 for pgsql-performance@arkaria.postgresql.org; Mon, 19 Feb 2024 17:46:27 +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 1rc7ij-00GL1A-9E for pgsql-performance@arkaria.postgresql.org; Mon, 19 Feb 2024 17:46:25 +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 1rc7ii-00GL12-P8 for pgsql-performance@lists.postgresql.org; Mon, 19 Feb 2024 17:46:24 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rc7ig-007YdQ-56 for pgsql-performance@lists.postgresql.org; Mon, 19 Feb 2024 17:46:23 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2d2387a5408so20189281fa.3 for ; Mon, 19 Feb 2024 09:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1708364780; x=1708969580; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to; bh=IezwIaG7KwMn4Lcgxg1Ri0jFv3+P50t5SaCdjXwgNng=; b=eOz4AQOkQPXyJH6pLX1QAa//shOOnPFWGpuB4CY46FQCVBtc3O4ShSP37Q7Yz0MGNK cYSv0Ua2gjF7oXF0sE9ddn/WexKo8IxKlEXWOA+TtNUMd+bZ+EIz1fH1owhiNwoZY4wq jeGSNfodZbARJww04yGKqbNbaFWlpogw/JmUsLkpqW63dxlm3n+zDye4ybh3geD9F0EI z75BfOQpo9+qwMRKl/epuSsuB9eHQFrEe8b4GFG9H7fLlh9u/NCjveuElCuAFG9ySalc m+2YoK6KFBN7GJKby7PatKRwf6hECs8fnwoOTGlKp2vkuo+8CJ2PMFt94JrQuGugJ5wN 496A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708364780; x=1708969580; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IezwIaG7KwMn4Lcgxg1Ri0jFv3+P50t5SaCdjXwgNng=; b=c7i0IwjLKX69/JMhtrRlUQnUzYfP8IU0DEPLIDqX7jOtOmhwsi/Ig8Z0Zo21KTaFvg LmJ/kAAYKMpJeJsDBejuV3Zd2SQVc66NvnaGjwqso4jQjctoalYjbHQ1wNTF+sKFaQAd iy5r1bhjICBG1qxXGWv1SJ0MhdNikkB8YVjAov5KKN8pinGsWSAmgSipDl/dAtgOxrzY t1qiVTBeqqE+XXPKNpMErC9ctsJdFj6l52IkAKJgk2dtXeb1KxRKG/o9yazOltelj9AL 5Z8Uab7QGEmeG4Txmct9Z3pq7FBQwykY88df0MsHwCti8XZNs8LGkYLAeSgLtvSeYMT7 IPhQ== X-Forwarded-Encrypted: i=1; AJvYcCUtshuhmVR5f2C2YRj7v5u4anEf9yO7/t5eoDZvlAvl2905Mb/9PqukD7dSaYj5GoeKRuv4fJq+uBbR+0nLjPS4OoO4Nb5wNkpfBzJyU8DxaK5Fs2coQA== X-Gm-Message-State: AOJu0YxdE8Hzc9OwPoheUBrx2NwcOcyDPypv5Cu+eboZG8kg2Hx04FpK h69dZYT3gdPhwarqPEC5uTv1Xihx+Wn7MTxnuj/1ZcCaR+FC5LfZoS9qobehlCc= X-Google-Smtp-Source: AGHT+IF9lyV6UUumRviXUNbtrybt+YIvqZUmQLOpiat380AEAOulTwci41af4C5k4D60lLjqRmaDLA== X-Received: by 2002:a2e:9993:0:b0:2d2:3820:fb4f with SMTP id w19-20020a2e9993000000b002d23820fb4fmr2473937lji.12.1708364779997; Mon, 19 Feb 2024 09:46:19 -0800 (PST) Received: from localhost.localdomain ([2001:871:260:5219:f12a:7e:8863:69d1]) by smtp.gmail.com with ESMTPSA id t17-20020adfe111000000b0033d56d43fbesm2542178wrz.115.2024.02.19.09.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 09:46:19 -0800 (PST) Message-ID: <6ba1f723a0b6af4a1deedbe543c70ba2630b4e09.camel@cybertec.at> Subject: Re: "not related" code blocks for removal of dead rows when using vacuum and this kills the performance From: Laurenz Albe To: Lars Aksel Opsahl , "pgsql-performance@lists.postgresql.org" Date: Mon, 19 Feb 2024 18:46:19 +0100 In-Reply-To: References: Autocrypt: addr=laurenz.albe@cybertec.at; prefer-encrypt=mutual; keydata=mQINBGGDwAQBEADgbWy5cKXQld3N2mF+DFyiNFbi2oBl2T+XgxpPF8wTRw2D/u4bBKXP0SYSE/lA86jIVNWWU0gf1KODIkVvgJm2w4vH2VBV1b7ddVViGl1Iu+9zaRnv9wulhnH42KefepXnoean6UT1EzLM0opF/Ik0j+40TxdRtobkBprkQUyHDXWlHc2ffPs3SipyFEP9AVLf7ejRC46CXWDnsqjOBSMEW8Z4HiK/8RrPZBsKLts8dJxKF4pygOdJb0CWk8k/X1jbcfdxo+zOLjOMvJcSJ2pFdJmQHU+JufB3rePziqQ2S9Ur6sccr9XnTC1GVBWN4Lf5VHq+vf+bFJjVwg+2hrySZnAVfcOrxoqFLErr7ug1zN2nM1kcpgA4VWn4gxlJtYNYYq+9WxX5dtvnNANlG3ZCrRKQzl8lxtzoF6Zo7LUhEqPaHDwn7Rvs+IdbOn41lF5UDTJGqmC4gS/bZydW2Fy3YWm4aSaN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nKscclVpOgjKaBqC+0iFiVaRqAgfOlIEiezX6kMh5Q2FIUfqs46qWhhXjRrdKOEoStYAaikdLu5ZXr7vfb0ZaDh+ZwTQtbSMFolyOkecwI81MCdbMfT/1TqIGTOdAj5as9fAakk0jb2pXgUYQ8X1DVTR8ahSDVEaw9VTmWiSvTxvguVJ1Mb7gG4Gmh6aviDTJhfXtH4rPUNXhDLqrTH8JkJjyKROOMakIF68Hjse5vUfUxreBEOtb5r1Coa2Fe7ncJayaSE7ryrDbFqpZ 36UMAx4ulWMyqJajLNGY0DdG8qIsR5nxRhrnK/mrCidZ8F9/D3bWAl4rjtHlsztN59 +AnW5l0HsQcY9ntFL/zEBOaonjdJf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 (3.50.3-1.fc39) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2024-02-19 at 16:14 +0000, Lars Aksel Opsahl wrote: > Then we start testing VACUUM and very simple SQL testing in another windo= w. >=20 > We can now show we have performance=C2=A0of "3343.794 ms" and not "0.123 = ms", which > is what we get when we are able to remove dead rows and run a new analyze= . >=20 > The problem is that as long as the master code is active, we cannot remov= e > alle dead rows and that what seems to be killing the performance. >=20 > With active I mean in hanging on pg_sleep and remember that this master h= as > not created the test table or inserted any data in this test table it sel= f. >=20 > Is the expected behavior ? It is not entirely clear what you are doing, but it seems like you are hold= ing a database transaction open, and yes, then it is expected behavior that VACUUM cannot clean up dead rows in the table. Make sure that your database transactions are short. Don't use table or row locks to synchronize application threads. What you could use to synchronize your application threads are advisory loc= ks, they are not tied to a database transaction. Yours, Laurenz Albe