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 1kFeuN-0008Iv-JY for pgsql-general@arkaria.postgresql.org; Tue, 08 Sep 2020 14:47:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFeuM-0002ur-I4 for pgsql-general@arkaria.postgresql.org; Tue, 08 Sep 2020 14:47:42 +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 1kFetu-0006fb-Ps for pgsql-general@lists.postgresql.org; Tue, 08 Sep 2020 14:47:14 +0000 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kFets-000890-Sr for pgsql-general@lists.postgresql.org; Tue, 08 Sep 2020 14:47:14 +0000 Received: by mail-oi1-x244.google.com with SMTP id w16so16700083oia.2 for ; Tue, 08 Sep 2020 07:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=0PMnL44WKqM2BV7TXbpD8xMnxIi0XYqPYP3MqR4YlKE=; b=Ds7Ph8+nwVYcj7A+GBaGTASJBr12WYVYXcWaEfUgzeqb9WIut54ALe2FtCLE2Hy+6R 1zkESjdWYSn3Jpc9GOYWJwmo5v+Uk8ltIFs0s089BRAuZar1Knb46GphYh9gLuyOMIgn 7GyoibWH46jVdGl1SfXEqRqNUjiaGIqzsk9SBW/V8imtg3P74BD3Tst0b2iePt4tfFqG GCUBB33M4EnK9N8duamfNsFg1iVAL+YBM+UMmNDPbLDvS80rxjkUn51EmJPozO2wj8NH 4j8mbFWkD06OO63G29ct5nhAyCQf4k7EHDy9qbU5x6/m1hfCqF1TeLT4g2r1hDO/IhLy YjLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0PMnL44WKqM2BV7TXbpD8xMnxIi0XYqPYP3MqR4YlKE=; b=XXKx3XxSWSgAGWtQIH3HU0QBUQYB6Dcx5kSBPzSlWthcnQqZcd0RRvB2asTpXcTSlQ 3E2R4C3Fawp5Z3/yGsqctKKc7Tz8uP1aDZmkx5QHRqDD8K8/zKZQatJmZVv/8FQ3CmGR tJeA/ogPI19/55DDh4qm5szh+WYTKv0M2eJ3K2xfDugL+OxDt6AdcNepZ7EdP5bhDzDZ Bw5QUDt0LedRwoHeURhZOEBCekRWtD5ITATEyUFnXNJmVRZWMUwh77nbDJlc5TPe8p/G BrhZKcrzSzSWChdoYRTdZEsS0HM8k7QGyA7X1kD6R3HXYoDlxjkOFACpyJjTiNOAZYQV 4H7Q== X-Gm-Message-State: AOAM530T4ZP8ICpnhE/Y03BoVdiPAVSI81r7ozKAe8VUi0WiICfnAIaQ NU01ys+BzodWQEi3jO4DuQhKDYCgR+9WIg== X-Google-Smtp-Source: ABdhPJyBG3dIpbRoiNnnXRnvrRJKVNfT9UWtCpCIeSsi0sjuBTvH0Njh7vWOJTLmwSXT54B5qKAhkw== X-Received: by 2002:aca:ac8e:: with SMTP id v136mr2928079oie.113.1599576430391; Tue, 08 Sep 2020 07:47:10 -0700 (PDT) Received: from [192.168.1.10] (ip174-67-143-111.no.no.cox.net. [174.67.143.111]) by smtp.googlemail.com with ESMTPSA id z5sm1735929otp.16.2020.09.08.07.47.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Sep 2020 07:47:09 -0700 (PDT) Subject: Re: Autovacuum of independent tables To: pgsql-general@lists.postgresql.org References: <20200908082755.GI19261@paquier.xyz> From: Ron Message-ID: <0085ec6b-353b-dff6-a91c-d5a05ad712c5@gmail.com> Date: Tue, 8 Sep 2020 09:47:08 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200908082755.GI19261@paquier.xyz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/8/20 3:27 AM, Michael Paquier wrote: > On Tue, Sep 08, 2020 at 11:16:04AM +0300, Michael Holzman wrote: >> Autovacuum does not clean dead tuples of closed transactions in tableB >> while there is an open transaction on tableA. >> But the tables have nothing in common. They are handled by separate >> applications and there are no transactions that touch both tables >> simultaneously. >> Why does autovacuum create an artificial dependency on the tables? > This is called MVCC, which applies to a session as a whole. The point > here is that even if your application knows that only tableA is used > by a given transaction, Postgres cannot know that, as it could be > possible that data from tableB is needed in this same transaction, so > old versions of the rows from tableB matching with the snapshot hold > by this long-running transaction still have to be around. Too bad the START TRANSACTION statement doesn't have a RESERVING clause where you can enumerate the tables you'll be using. -- Angular momentum makes the world go 'round.