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 1iPggz-0001Ok-7x for pgsql-admin@arkaria.postgresql.org; Wed, 30 Oct 2019 05:38:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iPggw-0004FG-2t for pgsql-admin@arkaria.postgresql.org; Wed, 30 Oct 2019 05:38: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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPggv-0004F8-KW for pgsql-admin@lists.postgresql.org; Wed, 30 Oct 2019 05:38:45 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPggs-0000yQ-QF for pgsql-admin@postgresql.org; Wed, 30 Oct 2019 05:38:45 +0000 Received: by mail-wr1-x441.google.com with SMTP id q13so790742wrs.12 for ; Tue, 29 Oct 2019 22:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=zbaxG5ThoBrcquJpWYhyCIjqqWy9oswI0vnkPU6VPVY=; b=PRjBKwV+cajAc2rT86YDzXcGi6rzbKG4YVpZicfdCJBuHNLnZihwqDSjU26gv/9T36 wTodCV8Bbl7pA3js2tRpYWqecszkxUrp0kBYniQL98UySKb/uB1CpUyLMd/1TJlrTIp4 wYsXAL1bFhqtjLnjcRmXegy5PtkTukzXzYx0pYeZlW/DNZquTL40EbsiLX54cyqaitP5 zvJs+OxAlavahbkc3l3R+foQtuA/r5iT6XnjKK7ZNktkcQbgb3SrBRmkDHOQGoQ+iopu tSy6W8dNRBlgknm/zwFckhzeGjKTqhIpNJ0871yf2Lxm1x9G0kYhm2LZiOIhLyBqkJa/ 8gyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=zbaxG5ThoBrcquJpWYhyCIjqqWy9oswI0vnkPU6VPVY=; b=KbDCG5K7Ro4FwFPzVl5UtZUGMBfjg7iz4Wfh9gxIiKMmwbFaU5sD0n84sxTD1EBM4V lZZjDXs2BVOYteP22K645YGHwzOlmXrOnzgRsmQAUHBVuGN1L5bItkASO9Etn5EwsizK Uz8XIGiRWPr5YEQ92suoVjf5Xk63oBUpVvQ552xqMJIK3FKNQe3Y2+sE/QKGo7qyJ/94 3ow2eN5M5MdaOmZdV5l5kwb/Uo1VT7mIM9whMshNG+A8NthpBPVg/vK27HANdzx0liBt Wp7VbCOPWOxTSKtmuSSmL/cLloyrZP6sTFZwFbJCFMinCqZeLbiZ8jkNSwnZe7VGd4IS ro8w== X-Gm-Message-State: APjAAAU49vd1R6TLnL4pewBIznbkELPNMS/KO9TQExLDULlniLqu9nvS bGsrMROS6VwZ9dO6LlDpoGIryw== X-Google-Smtp-Source: APXvYqwvh3Y751XcZmiR3hcftm9YV/C/+3zd42Su8GVRpawGrmKxlICBAysgJ3A1vSP/+/KS56anGw== X-Received: by 2002:a5d:518c:: with SMTP id k12mr647526wrv.104.1572413919101; Tue, 29 Oct 2019 22:38:39 -0700 (PDT) Received: from android-fd1fa1e17354e78d (248.95.194.178.dynamic.wline.res.cust.swisscom.ch. [178.194.95.248]) by smtp.gmail.com with ESMTPSA id f6sm1334634wrm.61.2019.10.29.22.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 22:38:38 -0700 (PDT) Message-ID: <7fd7f4eb1073884acfb673580f5ff589fcbf7abe.camel@cybertec.at> Subject: Re: Forcing analyze on DB after upgrading? From: Laurenz Albe To: Wells Oliver , pgsql-admin Date: Wed, 30 Oct 2019 06:38:38 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 2019-10-29 at 22:11 -0700, Wells Oliver wrote: > I just upgraded from 9.6 to 12, and am noticing some queries are slow. > > I did this kind of query: > > SELECT relname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze > FROM pg_stat_all_tables > WHERE schemaname = 'myschema'; > > And noticed null values for everything, including last analyze date. > > Does this mean the planner won't be able to optimize for these tables? > Do I need to do something to prep my DB for planning after upgrade? You used pg_upgrade, right? pg_upgrade won't migrate any table statistics. You'll have to run ANALYZE to collect new ones. This is even mentioned in the output of pg_upgrade, and it writes a convenient shell script that does the ANALYZE for you. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com