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 1pgvqo-0002qK-Au for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Mar 2023 23:02:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pgvqn-0006oa-8S for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Mar 2023 23:02:05 +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 1pgvqm-0006oR-Ts for pgsql-hackers@lists.postgresql.org; Mon, 27 Mar 2023 23:02:04 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pgvqk-0005F1-JD for pgsql-hackers@lists.postgresql.org; Mon, 27 Mar 2023 23:02:04 +0000 Received: by mail-pf1-x42e.google.com with SMTP id s8so6777845pfk.5 for ; Mon, 27 Mar 2023 16:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timescale.com; s=google; t=1679958120; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=YehcXGKU75rM2nMLwLy3qyLmg4aWTRmdu5QolS9CCHs=; b=KLiI4qaEu1i7FkII/84an0ofGZkYXn44iwbkoDh0+5Dxo9Ac/w2PfNT6Uldd/cPJuv 4e3uJ2M9aC0vXN1IjTF8AK6cOex+xttDXN2Z8Ydt3N3hY/4S6S8eIPihqvXOEU5CNulV lGfoM7YjgixgQlOnbAwxBDaGuDoq34erQz4nLo6xFQ07J/0o5XiJA7ys5+T0c94H+U5S hhyMi6m9cN0qiNF5fjHJyAqe2jrgI8RHfM3+NbFOn0b1gtVkpwgkGUYDFW+0yMIAzHg1 fDaVsfXXsOTWGejzIjzd3RBmE/IPp5u4U00MpytH8yh3WR+UmYb3tzs+qvOXdeEMR+y7 PHEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679958120; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YehcXGKU75rM2nMLwLy3qyLmg4aWTRmdu5QolS9CCHs=; b=WcHbE4iY+WVRyAvthPYd/G4asRSTGTcpSrkLbrkaN4i0XA5t5XVOkzqemtucMrpC+s SxkqF7hfAixl2WclIVPo1aBKT0avjxx0Xzar4NJh9dhtPu5lgA4lLOJ+O22lshd1DpAl F7hbovYAXgEZXrp1mBpYBHN76hbRgTIV0aHu5Gk3I2eRY09X4SO0D5CWtG4VWn16TjFO Br4JUV/qZZQPAUAqY3EoRVMB4BliU9wviOpoYpd5Zj1kNg3OVD8G2zOdeJ+6C5JIJnK1 dCvI2juJ8h1zKGsyIoS6rgahR05UsuzeKOFXoMzp5TpyN7VgAlQLDcP4G1QXaCIxcFbr WheQ== X-Gm-Message-State: AAQBX9c+xQOkXapDzWZoYms8+OP6qMrxbPwuJ5ROsu2EIq44eTcFllzZ NQeDuecZfeIbSKuZnUfyGuU/CA== X-Google-Smtp-Source: AKy350bxvGy/5aUMV7IC4QCOVVTfEnOyFUvI02nQ4Bq9pESQkHI3IE1cEhcgvnLDvQNqriRRm0iKOw== X-Received: by 2002:a62:64d1:0:b0:626:237c:bcfe with SMTP id y200-20020a6264d1000000b00626237cbcfemr12696411pfb.8.1679958120252; Mon, 27 Mar 2023 16:02:00 -0700 (PDT) Received: from [192.168.1.21] ([50.53.8.205]) by smtp.gmail.com with ESMTPSA id g11-20020aa7818b000000b005892ea4f092sm20151933pfi.95.2023.03.27.16.01.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Mar 2023 16:01:59 -0700 (PDT) Message-ID: <185c4ac8-fbc8-11a5-d721-55f639969eb8@timescale.com> Date: Mon, 27 Mar 2023 16:01:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 From: Jacob Champion Subject: Re: Data is copied twice when specifying both child and parent table in publication To: Amit Kapila , "wangw.fnst@fujitsu.com" Cc: Andres Freund , vignesh C , Peter Smith , "Takamichi Osumi (Fujitsu)" , "shiy.fnst@fujitsu.com" , "houzj.fnst@fujitsu.com" , Amit Langote , Peter Eisentraut , "pgsql-hackers@lists.postgresql.org" , Dilip Kumar , Greg Nancarrow References: <20230207202834.c2ptvco7dv57t3hi@awork3.anarazel.de> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 20, 2023 at 11:22 PM Amit Kapila wrote: > If the tests you have in mind are only related to this patch set then > feel free to propose them here if you feel the current ones are not > sufficient. I think the new tests added by Wang cover my concerns (thanks!). I share Peter's comment that we don't seem to have a regression test covering only the bug description itself -- just ones that combine that case with row and column restrictions -- but if you're all happy with the existing approach then I have nothing much to add there. I was staring at this subquery in fetch_table_list(): > + " ( SELECT array_agg(a.attname ORDER BY a.attnum)\n" > + " FROM pg_attribute a\n" > + " WHERE a.attrelid = gpt.relid AND\n" > + " a.attnum = ANY(gpt.attrs)\n" > + " ) AS attnames\n" On my machine this takes up roughly 90% of the runtime of the query, which makes for a noticeable delay with a bigger test case (a couple of FOR ALL TABLES subscriptions on the regression database). And it seems like we immediately throw all that work away: if I understand correctly, we only use the third column for its interaction with DISTINCT. Would it be enough to just replace that whole thing with gpt.attrs? Thanks, --Jacob