Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aQPf9-0004hk-3U for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Feb 2016 01:21:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aQPf8-0002NJ-Df for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Feb 2016 01:21:46 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1aQPdo-0000st-DK for pgsql-hackers@postgresql.org; Tue, 02 Feb 2016 01:20:24 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.84) (envelope-from ) id 1aQPdh-0000ta-0W for pgsql-hackers@postgresql.org; Tue, 02 Feb 2016 01:20:23 +0000 Received: from auth2-smtp.messagingengine.com ([66.111.4.228]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0Lqyi7-1ZnnZN0lJz-00eYsq for ; Tue, 02 Feb 2016 02:20:14 +0100 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id DE097208EE for ; Mon, 1 Feb 2016 20:20:12 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 01 Feb 2016 20:20:12 -0500 X-Sasl-enc: 9Q+MYfofbUZ2/0V4DexVrA5oxtvq2iuqL5IXQZ/EbNxQ 1454376012 Received: from [10.0.0.7] (c-73-13-69-21.hsd1.pa.comcast.net [73.13.69.21]) by mail.messagingengine.com (Postfix) with ESMTPA id 89C40C00018; Mon, 1 Feb 2016 20:20:12 -0500 (EST) Subject: Re: statistics for shared catalogs not updated when autovacuum is off To: Jim Nasby , pgsql-hackers References: <56AD41AC.1030509@gmx.net> <56AF7093.7070804@BlueTreble.com> From: Peter Eisentraut Message-ID: <56B0044C.1030001@gmx.net> Date: Mon, 1 Feb 2016 20:20:12 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56AF7093.7070804@BlueTreble.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:D/n7TB+5Gm75JHvy79Xr8b5Xr1EDfHw44xM5nSH6C7Vcs9XZt2K nyG8u8wYC41t7nIovzU4AZ0+s49mXXaopDAbRXXHTCai79U3zEgJcao/Ju4RRfRQF1ft4kd qQ3/fe35oT0YyDJ3VJOg01k2HmhJRv+HXcsw/4DSaQtFI4iIyjmFf9BzaCe4gojqrECZYyJ nutrPH1lJ0vc1Yew7ximA== X-UI-Out-Filterresults: notjunk:1;V01:K0:ruCar+yhqpM=:w5GAcjUEUf2yLWPCT9ORNT f8yIv0yYLGBV/lqgFnq3koZ8xiSdZW4xNfi3qj70/hqdWdy9b7vCupPQuIR5CmUSiVpq5SGw8 RCfBz4WL0xjkjnggUHSZcLJnXxb5pHaqNFyWl/u48UsxFnExieaTKbJ7GRjr91AK3Qvp4rtzh WD8p/G5jnYOl52n2m8k8ENlVRjolRAudr7IguhrQO7+exfvxqJ4QSy8/MkUgO5r4sEGtsI3UQ T1RrL1FZIBEQCixFB4Rv+dJw8cyqBoATzBiKuBcZwG1yGMoHLdBFdHb8Kk6egJ7M5VSi3fk0D H5q+kAL4eATtRNN36o+WVhM6SjfKa2qxHDJnqSLPRli6wR/UXNKZKfD0ITmUwZSIHLsmCMa4Z qh5IsXGSbffTD0/1FxSpkCSGRi+QTF4HXepOEgEEPte3rQq8rdarQxeXbhstMyNYH3moI+aFe 21hMw8JBKUbuS6jiAYTLr24/e4aqzqrYIU7uDB7/R5LCuXzSHc7SoAC+YQTbUQf6rF9n3lqyL 33ygaCRu8jSvTSKlrj3wEX61WIDzUQqj0B8Zdzr0MKDIjGkMyL9KtOHtUyUt2EOo7hoEU48Sj 7sI504L8DNpXXMv3IeDhKZLXDSh6uNvzljm7UpSZF8a+edIhoWElpddbT+iGrVByYCYyMKw/I pOpFsRyNEFrJyT3IUQJ0uIcMi2qsYo6pM0wZ7ZdZxOui8PMwsVvdtBqLNfgaq/Gp1GNoAjVzv LGtN10UMeNb4KSAPqi+WStUldO85tGPRAZV8pxhl84ibEBvsyO+WmX0Bn9H4gFTsFUVMeSZlb NddD2nf X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2/1/16 9:49 AM, Jim Nasby wrote: > On 1/30/16 5:05 PM, Peter Eisentraut wrote: >> When autovacuum is off, the statistics in pg_stat_sys_tables for shared >> catalogs (e.g., pg_authid, pg_database) never update. So seq_scan >> doesn't update when you read the table, last_analyze doesn't update when >> you run analyze, etc. >> >> But when you shut down the server and restart it with autovacuum on, the > > What about with autovacuum still off? nothing >> updated statistics magically appear right away. So seq_scan is updated >> with the number of reads you did before the shutdown, last_analyze >> updates with the time of the analyze you did before the shutdown, etc. >> So the data is saved, just not propagated to the view properly. >> >> I can reproduce this back to 9.3, but not 9.2. Any ideas? > > ISTR that there's some code in the autovac launcher that ensures certain > stats have been loaded from the file into memory; I'm guessing that the > functions implementing the shared catalog views need something similar. That's probably right. Even with autovacuum on, the statistics for shared catalogs do not appear as updated right away. That is, if you run VACUUM and then look at pg_stat_sys_tables right away, you will see the stats for shared catalogs to be slightly out of date until the minutely autovacuum check causes them to update. So the problem exists in general, but the autovacuum launcher papers over it every minute. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers