Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eLzMB-00047V-R6 for pgsql-admin@arkaria.postgresql.org; Mon, 04 Dec 2017 22:37:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eLzMA-0000N7-Kg for pgsql-admin@arkaria.postgresql.org; Mon, 04 Dec 2017 22:36:58 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eLzMA-0000Mu-7k for pgsql-admin@lists.postgresql.org; Mon, 04 Dec 2017 22:36:58 +0000 Received: from mail-qt0-x231.google.com ([2607:f8b0:400d:c0d::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eLzM3-0007wi-2h for pgsql-admin@postgresql.org; Mon, 04 Dec 2017 22:36:56 +0000 Received: by mail-qt0-x231.google.com with SMTP id u10so24845654qtg.2 for ; Mon, 04 Dec 2017 14:36:50 -0800 (PST) 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=MF9uCpCJPrjqIDtP/Ik3u3l9QGa3iBsah8xl/k9b5xU=; b=ah2VcjSxtiSB1Wxg6GqF+QmKH0MMfKDl1PCn5ZZDeTyxm30cggZC+ESuYfbXcHOQOp jEFC9659iIRFZdx29LsekKsm3/qgHOzndP7DD1ZkWFdZd2zxAkTnibw65Y62MAMjDVaW 3fl+Kr8yEA7lfbo+su8TijmD42Xecl5lkKBWEhg5ykSl2QwTrTNIA0k2ncPmkUbceEGj Yrg7Y1I7786LYrZB8X8yw+/A5hbIPXupi0I7/t5S7jiadkxVQBvmgIMJfyHZEt7Ocnyd 8SquVWkuURfjF4ITsWTNvPxoTAVOPgR1pmgUmcJ0TGegAfOtj4tVdqCd5EQaJWLDX8pm ckAg== 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=MF9uCpCJPrjqIDtP/Ik3u3l9QGa3iBsah8xl/k9b5xU=; b=fLav+Jv2irsgnGe5HzdVIaK5z1LA4kPRfeqYNYxVMY+B0S3kkOIkQARTaTfbtBx8/C TSFLsaqNvg2e1geX4u/6t0x7VgmygmBchjp5dBXcRHIb/iwfzmEEINlXRlFa/WNddK9g U5s5VYGo4x/2uTKEin5NRnJDSks8WALzyt6H6CznVgNP+lmE1qLoenFNDUJQ599ZSdhG vXIwtfXHqmpfsfCzj8L8CXsZKkBNoJofggKUfES59unYY1nMlCTNMZdfvi8nLAbKbrh8 ibGnDFuTPkHcLLDll30jp05uoQYsBE4G0NkEQtMrDgEE6tIsDSKHFDnbdgw7DuaQD2Be YeeQ== X-Gm-Message-State: AKGB3mJmReYlAluNg2a9AfFxdxmMBiBgZ77d38wmmP7wIC77x+mUH0AH Vu75nhJXdBqkz6pmxj8Hn9/sNg== X-Google-Smtp-Source: AGs4zMYXIuWLA/rHW0fCiA+rcOjO5CAecPlDVc53pORfJMaeYM+2lVTOygw60ZrhYvauwmaLXdj/Ig== X-Received: by 10.237.33.130 with SMTP id l2mr295725qtc.120.1512427009919; Mon, 04 Dec 2017 14:36:49 -0800 (PST) Received: from alvin.alvh.no-ip.org ([179.57.113.18]) by smtp.gmail.com with ESMTPSA id d79sm9736078qkb.58.2017.12.04.14.36.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 14:36:49 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 760AA12D1; Mon, 4 Dec 2017 19:36:47 -0300 (-03) Date: Mon, 4 Dec 2017 19:36:47 -0300 From: Alvaro Herrera To: Don Seiler Cc: Adrien Nayrat , pgsql-admin Subject: Re: No stats after promoting standby? Message-ID: <20171204223647.d2sim25ndz5lmqw5@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: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Don Seiler wrote: > On Mon, Dec 4, 2017 at 4:02 PM, Alvaro Herrera > wrote: > > The docs are telling half the truth when they say this is a > > not-bug-but-feature, though. It's true that we don't want to overwrite > > some of these counters, such as number of scans, number of tuples > > accessed, etc; but ideally we should keep things such as vacuum/analyze > > counts and last times, and also the counts of dead/live/ > > mod_since_analyze tuples, to keep autovacuum informed without requiring > > an ANALYZE. > > I'm not so worried about the time of last vacuum or analyze but the > statistics for optimizer usage would be necessary. The optimizer stats are not lost on crash or promote actually; these are stored in pg_statistic (not in the stats collector) and *are* part of regular "data". > Otherwise I would think > the time to complete a failover would have to include that "vacuumdb --all > --analyze-only" run as queries run before that could be very out-of-sorts > with no information on the data. Although perhaps I'm misunderstanding > where the optimizer gets its information from and these pg_stat_% tables > are not what I seem to think they are. I think it's pretty common misunderstanding -- it's not easy to see the boundary between pg_statistic and pg_stat_* tables. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services