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 1iFIZP-0006bm-Pf for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Oct 2019 13:52:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iFIZO-0000Ea-2Q for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Oct 2019 13:52:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iFIZN-0000EE-MP for pgsql-hackers@lists.postgresql.org; Tue, 01 Oct 2019 13:52:01 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iFIZG-0004ve-Uf for pgsql-hackers@postgresql.org; Tue, 01 Oct 2019 13:52:00 +0000 Received: by mail-wm1-x343.google.com with SMTP id 7so3500974wme.1 for ; Tue, 01 Oct 2019 06:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ah3Um3xgk4GWQCtJK5ATAYcH4uvfbRZFZYE3r7Svo6Q=; b=WZrh/zceVkLP7QRG2MxXxRJrCqV1zs0YqnlbCYwCIA52Cfwb4+NWR8HLPJ8UJ90xog NS8QUYoYQYLhzFVPRbIVkjHWP+u2xr4a0UjkRmnaDxhAvOvihCj+McCcci40b2k7Y3LI tEZsG9Vw2BRAGH4DQ6EjhY5YXO6Q2GgH3x+LfSEeMPlV9Lxrnuk9XGgjuQzTZ/VF9Pei KlFTD54OwZlw8MWmlukvFs68EEVUziD5Qg+WDJgJVhAKtEN0J8l37Y2tZUA3G1vRvHwI IuAcj79DK3Jdem5HddfpTDyL5MrPvZTCrbJOTQVPfJy6S1PL2y1zjgA3YK2LUyT7uB3a EvWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ah3Um3xgk4GWQCtJK5ATAYcH4uvfbRZFZYE3r7Svo6Q=; b=Iz2yL5KNNIkmf5XFRVeWbJnh8gzph5KTWxszR2aBvvtYvFQ5I2lH8XUp3gSiNIGuNH n4oCgDl7TXtDdG6vvqIEP1mNRYH9LOowG7wxM85JT3MDcqKsRRbeBrck1I8XAKoFsthp TVbOH/1Bl8+IZ2f2ZJrZ4wbBs64Pj7lJ97jQDp/2EkpgnaFJkMwxsMHGBVcLxmqcoM5w Gt876Dc+UtQKvU2C0D28ETybGziEpBY3uEGQilacxJ+NW7X1fOkxbZc6wfRdMNb+Arj3 /Ix3gfJx9BYdD3sulDp6sFB83NBN5MDo2nq6d7vju8/UT7GOtHUfX9REQKqOi1imD8Ja qdwQ== X-Gm-Message-State: APjAAAVFSf25+Y09XEJRMPSf2QhmDA2MIx7oQHugaiZHgVUVc9diw5N5 inoyWLTsyrP3p4ocrLlV/7OVMA== X-Google-Smtp-Source: APXvYqyPai8OvDxUxfmi2ldEZCmln9x35fu27P5bX2Hbf2FjOfb3XvTxQL0blA6tgeRjcXmk5CgfAA== X-Received: by 2002:a05:600c:c2:: with SMTP id u2mr3609571wmm.37.1569937913687; Tue, 01 Oct 2019 06:51:53 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id y186sm6190394wmb.41.2019.10.01.06.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 06:51:52 -0700 (PDT) Date: Tue, 1 Oct 2019 15:51:51 +0200 From: Tomas Vondra To: Amit Kapila Cc: Peter Eisentraut , PostgreSQL Hackers Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions Message-ID: <20191001135151.swlspdnkxxnhszhn@development> References: <688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com> <3530384f-f73a-186a-a728-8eeeb5533a10@2ndquadrant.com> <262cc9df-0d19-3fca-f899-0890bd2cd4be@2ndquadrant.com> <47e505c1-9a21-9edf-9a97-e13acce5aa21@2ndquadrant.com> <20190927112520.3kco6tqbhcvlk6cd@development> <20190928190917.hrpknmq76v3ts3lj@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Oct 01, 2019 at 06:55:52PM +0530, Amit Kapila wrote: >On Sun, Sep 29, 2019 at 11:24 AM Amit Kapila >wrote: >> On Sun, Sep 29, 2019 at 12:39 AM Tomas Vondra >> wrote: >> > >> >> Yeah, it is better to deal it separately as I am also not entirely >> convinced at this stage about this parameter. I have mentioned the >> same in the previous email as well. >> >> While glancing through the changes, I noticed a small thing: >> +#logical_decoding_work_mem = 64MB # min 1MB, or -1 to use >maintenance_work_mem >> >> I guess this need to be updated. >> > >On further testing, I found that the patch seems to have problems with >toast. Consider below scenario: >Session-1 >Create table large_text(t1 text); >INSERT INTO large_text >SELECT (SELECT string_agg('x', ',') >FROM generate_series(1, 1000000)) FROM generate_series(1, 1000); > >Session-2 >SELECT * FROM pg_create_logical_replication_slot('regression_slot', >'test_decoding'); >SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL); >*--kaboom* > >The second statement in Session-2 leads to a crash. > OK, thanks for the report - will investigate. >Other than that, I am not sure if the changes related to spill to disk >after logical_decoding_work_mem works for toast table as I couldn't hit >that code for toast table case, but I might be missing something. As >mentioned previously, I feel there should be some way to test whether this >patch works for the cases it claims to work. As of now, I have to check >via debugging. Let me know if there is any way, I can test this. > That's one of the reasons why I proposed to move the statistics (which say how many transactions / bytes were spilled to disk) from a later patch in the series. I don't think there's a better way. >I am reluctant to say, but I think this patch still needs some more work >(review, test, rework) before we can commit it. > I agreee. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services