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 1jqKhM-0006VN-NG for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2020 18:09:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jqKhL-0000kI-Eg for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2020 18:09:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jqKhL-0000kA-3v for pgsql-hackers@lists.postgresql.org; Tue, 30 Jun 2020 18:09:35 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jqKhE-0000Ie-DA for pgsql-hackers@postgresql.org; Tue, 30 Jun 2020 18:09:33 +0000 Received: by mail-qk1-x741.google.com with SMTP id j80so19544643qke.0 for ; Tue, 30 Jun 2020 11:09:28 -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:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Zuw5Hnjb1u9uG+QCrxX17uYBdH+/tjz4iAhzRYIWKo4=; b=AhcV6ZD+sxKoXZb2YZSaMltZZFdmd0T3/JWJsgvdaDV9UNpQYsP7SXhYo3eKAhlT6t RRYojPs2+SD42AHOUNmp44YlSmg1qAtALC+b516teuTpyS4DzxBmwAviTV6VxzES/vSn 386Q+Ojz6sPUUkmDAyI83IT28t0HE1iZyQP5ebd6/TLFgBavbgqVZdgsJFE0mnPaf1PA YTy4bQi2b2rGIA3cD9hwBRweOSuCbsu65wrActfIgTt8dXzHeZ4FeVB7JrvRs1Sq+syR MmYAAirgOtjibK1Hi4iQdm3OS/LrQ94GfNgBta+5fCfYEbjZmK0pfaFNpiSOIAzndQcG ZiGg== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Zuw5Hnjb1u9uG+QCrxX17uYBdH+/tjz4iAhzRYIWKo4=; b=Mlp/gtd/4xEfKLklwALGdVbTCyFB9bOTfRHP01dfpjSTQ8TslSZWtcgMUt6rd6PoPl H03bPJqYK2y47JsaHlVNItnYOrZEEPNclr7QCMarDonIEZ5vq2AQqS7B+KHPqJ6m3WLg FtkksYVuGI2GlTDR7vI2AwJzzRKt3hd8hcQmw/H2nANnQ3xS7r/aD3UYsi2Smry98xqJ SWOZLmgQDHbS1NeWWlMpHWseZQHWcuItfY0GbjAHpaOBkBC/C5yyPoKTn3X+mMRj7Lum +KTYfKrl3CbeOYKDg8dr7NTCFj5eeyfIutZQENFh9KLZBbXvJEfeFSb4xyp16UKOqvJG 57gQ== X-Gm-Message-State: AOAM530uMrkfg3X0mtMTY8Pzx/NE+G+/Fy2Pk6CRivGISFbLLgUH7oVb ZyipsGSkSZZmyhFK1KvqUar6fg== X-Google-Smtp-Source: ABdhPJxDHBOD0RS3QIDzMeuHF3LjrFXnWv1FjyYXgi4TRWeZhy+ru2AT9i4l9HVPx4Uqdx1qag8Mxg== X-Received: by 2002:a37:a78c:: with SMTP id q134mr22169482qke.368.1593540565284; Tue, 30 Jun 2020 11:09:25 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id h6sm3326592qtu.2.2020.06.30.11.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 11:09:24 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E09532A3E0F; Tue, 30 Jun 2020 14:09:22 -0400 (-04) Date: Tue, 30 Jun 2020 14:09:22 -0400 From: Alvaro Herrera To: Fujii Masao Cc: Amit Kapila , Michael Paquier , Kyotaro Horiguchi , pgsql-hackers Subject: Re: min_safe_lsn column in pg_replication_slots view Message-ID: <20200630180922.GA13453@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jun-30, Fujii Masao wrote: > Sorry this is not true. That distance can be calculated without those operators. > For example, > > SELECT restart_lsn - pg_current_wal_lsn() + (SELECT setting::numeric * 1024 * 1024 FROM pg_settings WHERE name = 'max_slot_wal_keep_size') distance FROM pg_replication_slots; > > If the calculated distance is small or negative value, which means that > we may lose some required WAL files. So in this case it's worth considering > to increase max_slot_wal_keep_size. ... OK, but you're forgetting wal_keep_segments. > I still think it's better and more helpful to display something like > that distance in pg_replication_slots rather than making each user > calculate it... Agreed. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services