Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YcxLb-0006zW-7t for pgsql-bugs@arkaria.postgresql.org; Tue, 31 Mar 2015 14:40:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YcxLa-0006jw-J6 for pgsql-bugs@arkaria.postgresql.org; Tue, 31 Mar 2015 14:40:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YcxLZ-0006jq-RP for pgsql-bugs@postgresql.org; Tue, 31 Mar 2015 14:40:53 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YcxLW-0006gj-1s for pgsql-bugs@postgresql.org; Tue, 31 Mar 2015 14:40:52 +0000 Received: from intern.anarazel.de (p5DDC7753.dip0.t-ipconnect.de [93.220.119.83]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 4470E860001; Tue, 31 Mar 2015 16:40:49 +0200 (CEST) Date: Tue, 31 Mar 2015 16:40:48 +0200 From: Andres Freund To: pet.slavov@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #12910: Memory leak with logical decoding Message-ID: <20150331144048.GL4878@alap3.anarazel.de> References: <20150327094757.2488.58808@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150327094757.2488.58808@wrigleys.postgresql.org> X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, On 2015-03-27 09:47:57 +0000, pet.slavov@gmail.com wrote: > I am trying to use logical decoding to replay the data modifying queries on > a different server, to synchronize some of the tables. The primary server > has some load, but not so much. I am getting the changes with > pg_logical_slot_get_changes limiting the changes to 50 at a time. That's generally not a very good idea. It's much better to use the streaming interface. Repeatedly starting/stopping a logical slot (as the SQL interface has to do every time) isn't all that efficient. > At some point pg_logical_slot_get_changes queries become slow and starts to > eat all the ram and swap, which eventually kills the primary database with > this error: > FATAL: the database system is in recovery mode. That indicates a crash. Please check the server log for any details? If it crashes, could you perhaps get a backtrace? What output plugin are you using? > The nature of changes on the primary can have a lot of data in one > transaction. Which I guess is the reason of the slow > pg_logical_slot_get_changes. In that case changes should just be spooled to disk. Greetings, Andres Freund -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs