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 1iDngZ-0004qv-0K for pgsql-performance@arkaria.postgresql.org; Fri, 27 Sep 2019 10:41:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDngX-0002JU-Sv for pgsql-performance@arkaria.postgresql.org; Fri, 27 Sep 2019 10:41:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDngX-0002JK-Gp for pgsql-performance@lists.postgresql.org; Fri, 27 Sep 2019 10:41:13 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDngV-0001ow-0E for pgsql-performance@postgresql.org; Fri, 27 Sep 2019 10:41:13 +0000 Received: by mail-wm1-x336.google.com with SMTP id f22so5647664wmc.2 for ; Fri, 27 Sep 2019 03:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=0tKIyjgqYvZAJdbFyIrBo1rItUA0Ft1L3ZDMI7Ryxyo=; b=Rc7Mzf+//OkaC3EAj7r69FGIcG3IJK0A/PvRPvRwf7ZNlM1gvbNwiCj1tnt22RIWYT A/BgrrM3NcIyco9f++nJ8tAeal7sBiANrnAX6i13Eo/ojWxyiI3wmuuvwSqRsSUUjfYk +k9muOKKTtYKxTdJ6/HFsM/3b63XZ6Ab9oduE/TlQH+4q6kp8O4wSuzymjlJivFDzWNb fzMV+DF+zDS4fVNFqAed3Qx3jS48csGXHIUX5zaUj/cgXbnVKfdoA8St/Pq/5kTknkiW 2QbH35UXri1pO/SRSzBMZpbxoXD/77co1ZKtn6fYkk6qqP4ZEGUmzaoN6VXfFwALvVrr AzBg== 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:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0tKIyjgqYvZAJdbFyIrBo1rItUA0Ft1L3ZDMI7Ryxyo=; b=KOGtMh85LR5GQjizNNqyD9baUfCslvTDVBOXqm62K/MU75Xy8SUCSe/52eChp6LkE6 9UiWn3hHf3LWRSMXC64IFUoGMuUUcDifReF2wd1/ScsJz3snMVoYa2PguiVhrYpsT7BE nFc1KAXIlZDnzWNQii0mXXNfhrLoGfH/QAMTTJDPuyS+tHsFsXQ1QwzugOjqPVQq2Hwl GgefMRQH0pB4WAW/G37reqQikYC6Ku2TcrAArycIie+Cfk6vmfmkEM5T6vfBV81WS3s4 2wZ4SK0SbMEOtx02iYTSoiL++28jCQG3KVWwH9dro6xRmHBIc6RaaWB/RjxbdvVn1UOi XTiQ== X-Gm-Message-State: APjAAAWSpC00P8KdR/kUkKSdzZFRe6cUHRKsmAZsAg6pOiqMk6P2rPe+ ksYWtmIp3tnAatckJpYHa0FeCg== X-Google-Smtp-Source: APXvYqyTWOXTs93x5SlMy1NLSYgmPehOvuPayotbNo+Ap9zyXdtg2Wm3bXHdg9fl88enevZFrdsONg== X-Received: by 2002:a1c:2144:: with SMTP id h65mr7019165wmh.114.1569580869162; Fri, 27 Sep 2019 03:41:09 -0700 (PDT) Received: from [10.8.8.18] ([185.94.189.189]) by smtp.gmail.com with ESMTPSA id y186sm9639684wmd.26.2019.09.27.03.41.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Sep 2019 03:41:08 -0700 (PDT) Subject: Re: Analyze on slave promoted. To: Joao Junior , pgsql-performance@postgresql.org References: Cc: Pavel Stehule From: Vik Fearing Message-ID: Date: Fri, 27 Sep 2019 12:41:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 26/09/2019 09:54, Joao Junior wrote: > Hi, > Is this necessary to run analyze on a slave using streaming > replication  after promotion?? > Yes, you should run ANALYZE on all of your tables in all of your databases after a promotion.  The data distribution statistics are replicated, as Pavel mentioned, but other statistics are not.  In particular, pg_stat_all_tables.n_dead_tup is not replicated and so autovacuum has no idea when it needs to run.