Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oFyIo-0006nV-Rc for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Jul 2022 13:39:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oFyIn-0006GC-N9 for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Jul 2022 13:39:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oFyIm-0006Fs-Fj for pgsql-bugs@lists.postgresql.org; Mon, 25 Jul 2022 13:39:17 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oFyIi-0002jC-Rf for pgsql-bugs@lists.postgresql.org; Mon, 25 Jul 2022 13:39:16 +0000 Received: by mail-wr1-x431.google.com with SMTP id h9so16052967wrm.0 for ; Mon, 25 Jul 2022 06:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=gjnnhzuyDEu4oFz8/jEeIPICZ4qL5KCkyA8AcVVNmdc=; b=PVwEEsm+eHfaV4o83w9BfwYk/JFQLG24cuF9RJ3dVcFvkwrrlLaAHi4UA+E/VeCOQK b63Qm0mZb8DIPiUZfrD2t3F14KVdzlSR0G3yvkq0prprWJ4lWZR2t/CPVu0309hnN2qe xx6nB/NIGEFrwvzlUDbZbyCH6ag5SqS4dxk27IgNNYBN/TbawgQgBuQMStjYz2DhYneH n1Fb7wEKTwMnQTwv/ovjEGdr6mzYqbIOR9RZV2wluTEyqk6Geem6EKvsODPyIjCbmA9U xaXbF0W3got3FZOkJw1i5d8pTDhxmdY1R7yM53IPqbfOwC3lNhlrMPDfpiGi4eQQmenh LSlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=gjnnhzuyDEu4oFz8/jEeIPICZ4qL5KCkyA8AcVVNmdc=; b=YxzhPOAR5UWKFQCCWx3GuSJM2JYER52f4J4ceROKNnICWVqxsQae8mymfu+UhyK69z mxVsgCE9GjkxG1wXVRWXuLMLZxeKDMQntht9RWCcmoRRs0uMhG9mG466HGMXf4zj73E+ gJc2fymqelUTwieJI3zE5YSNsehxaxYSuGRifOBgrrMRlXw2V4fGDNQDuVj2aJ0e/P6Y ECM+10TpbU4ou6MNtBh+osZvoRrBhCttVyFZyAUXzAxsBEdLbs5oyFjltLU9nNCsQMb2 x5y1POf38RApTvJXSOd3eEMxBwv89FZG3Oz/sONrRRW/KUG/9/ALVmFkPrZtbARzF2Ud MAIA== X-Gm-Message-State: AJIora+USD/V6n1C9R2dojkF7rPLrpr3pVPBldcy7vfZaMwSF19HPH7o 5xEr3DPP+ICCiWtpV46l5mJYTwEL6BKXxALGrw2NCebgDLFYidW/AkcCno0/rQ6wR3YhvDpVYci q0NfHCTMiK4WsL6zzzTaZrqxnHrKJSEWeYebwsAiX0KVr/v2wEVW935v/YPXaacDtw8jNSiPjAz kiBhdt9WyVa3PSkZF+y0H9NnjKFAj2DNXgW72jtuYusJDY X-Google-Smtp-Source: AGRyM1sPRATp8sSa1n2HXxEthmrHQAvstzGK7ox/9koLyr5/5gSsQHHTG54QVxscWd0Y3KqScxWn3Q== X-Received: by 2002:a05:6000:18a2:b0:21d:c50a:7c9b with SMTP id b2-20020a05600018a200b0021dc50a7c9bmr7863890wri.511.1658756351394; Mon, 25 Jul 2022 06:39:11 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-250-151.bb.vodafone.cz. [86.49.250.151]) by smtp.gmail.com with ESMTPSA id a14-20020adfface000000b0021da61caa10sm11762757wrs.56.2022.07.25.06.39.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jul 2022 06:39:10 -0700 (PDT) Message-ID: Date: Mon, 25 Jul 2022 15:39:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: Fwd: "SELECT COUNT(*) FROM" still causing issues (deadlock) in PostgreSQL 14.3/4? Content-Language: en-US To: Marco Boeringa , Tom Lane Cc: Bruce Momjian , pgsql-bugs@lists.postgresql.org References: <85acb61d-4cbf-7544-c734-429993257547@boeringa.demon.nl> <791d1850-f337-8914-1ba0-512f4e0fef26@boeringa.demon.nl> <2d7ff154-d0db-502d-aca8-a605fafcf395@boeringa.demon.nl> <6c9bf4fd-f22b-4894-d7c9-30bf68ffcf6d@boeringa.demon.nl> <883945.1658590435@sss.pgh.pa.us> <2dbccee7-9616-997d-cf19-fa23e29e0497@boeringa.demon.nl> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/25/22 08:04, Marco Boeringa wrote: > To extend on this, two interesting questions that come to mind are: > > - Does running SELECT COUNT(*) create WAL? > Yes. An obvious example is updating the visibility map (which is always logged to WAL) or hint bits (which may be WAL logged). I'd also bet we may generate WAL for indexes, e.g. to kill deleted tuples. > - Is it potentially conceivable that there is a kind of cross-database > vulnerability *within one and the same PostgreSQL cluster*, where an > issue in one database causes the WAL in another database to no longer > successfully be written to disk during checkpoints? I have never seen > processing errors where PostgreSQL emitted true PostgreSQL errors with > error numbers cause issues like that and affect a second database in the > same cluster, but since no error is generated here, and there might be > some uncatched error, I wonder? > > I am especially asking the second question since, although I wrote there > is no edit activity going on potentially generating WAL in the affected > small database, which is true, there *was* processing on Planet sized > data going on in a second database in the same cluster. That certainly > *is* capable of generating 890GB of WAL if nothing is cleaned up during > checkpoints due to checkpoints failing. > WAL is a resource shared by all the databases in the cluster, so if that gets broken it's broken for everyone. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company