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 1j1ygs-0006ue-3Q for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2020 20:32:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j1ygq-0007ea-1T for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2020 20:32:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j1ygp-0007cH-GC for pgsql-general@lists.postgresql.org; Wed, 12 Feb 2020 20:32:55 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j1ygi-0003Dx-Ll for pgsql-general@postgresql.org; Wed, 12 Feb 2020 20:32:54 +0000 Received: by mail-wr1-x443.google.com with SMTP id r11so3981475wrq.10 for ; Wed, 12 Feb 2020 12:32:48 -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:references:mime-version :content-disposition:in-reply-to; bh=hPycQMnjaQO9gpMTSeY3xhl1INJFqZ5AyT3li9VUvQs=; b=lBo3xxFI102fAOrzwrCi2iHrja8cswMQfkW+HxeRgl/wSmzhwJvf4lDjyaH4kPr553 XJcfgqJNsjSHqJft+/fwuKq9cONsUJdvMndAmP+qER5aV/OYwHqvLlx9ECF9rp+89BPR B9Sbv3/UZ8qPKAjyYrDqfEpxxxyB/e02uNyJxBSyIjQVxt5MpPNxRcKjV6o2R9tBSygJ bxLtSp8pKvyAn6g4gLIsBIZ+tq1D17t83Fp4tGvOHzVtUo/nxn4WkXX5Nn93d6corlao GCNR/MqnPOIMyqgphZCtZAw83utyZjvHrYPNMAvWF+7s9JVFfqmeOKUHhBktNIsEQs6P Bavw== 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:references :mime-version:content-disposition:in-reply-to; bh=hPycQMnjaQO9gpMTSeY3xhl1INJFqZ5AyT3li9VUvQs=; b=BNhjz5hOr0+dTYbetbRW8sMJ9aDVxCfBzYF0m9tJrKK4lFmuSg8+dYxxytFDd49UnV xL9ZAk6v0hZglooaKVc5EfgXG2T3emKF90uAOAEm90vRYUh9QmsmaiEzFbv/UmPpRNM6 H+g4B+xD3DV5JoUBe/Edgg039b4kkJDRH8RLe+Lr/qWuvFwBHdnY8L5x6IipsFfZgGcQ W8iKRKTI2peTPXeMfkmDR0LOE7dS3Xmn4+NcxNvVsW10+O1HelDd2YoEJVtGfj7OWkXu f3SReHHLEqWRj3LFJi+RLSyn/zRZCy2vrqzavxSHC8lYeLYe7RRzUn2XeI4/LLUzEpkD ZXAQ== X-Gm-Message-State: APjAAAVrvMY4WPCQKPOtzIJ4NaAv4KxJxMWkuaAXP4KGyidtN+a5/8wS aU0tw+5DhxJMCNmKkOBgwioMOA== X-Google-Smtp-Source: APXvYqymQSP89dZKL6lr57OYq6vD70dftM0etsukBiBRmKU7+XwPBXbSSjh+BwdtVBUC61LAKT2lsA== X-Received: by 2002:adf:e382:: with SMTP id e2mr17867500wrm.128.1581539567106; Wed, 12 Feb 2020 12:32:47 -0800 (PST) Received: from localhost (dynamic-109-81-208-155.ipv4.broadband.iol.cz. [109.81.208.155]) by smtp.gmail.com with ESMTPSA id z6sm2008663wrw.36.2020.02.12.12.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 12:32:46 -0800 (PST) Date: Wed, 12 Feb 2020 21:32:45 +0100 From: Tomas Vondra To: Michael Lewis Cc: Tom Lane , Tim Kane , PostgreSQL mailing lists Subject: Re: Avoiding out of date statistics / planner Message-ID: <20200212203245.yuilq66zbxu3iv7d@development> References: <23751.1581520559@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Feb 12, 2020 at 10:23:22AM -0700, Michael Lewis wrote: >It may also be worth noting that it is possible to make autovacuum/analyze >more aggressive, perhaps only on the tables that see large changes in data >that might result in a statistics issue. If you could share a query, >explain analyze output, and pseudo code or at least description of what >sort of bulk operations are being done, then more insight could be offered. Another thing you can do is deploy auto_explain, and log explain plan for long-runnning queries. That won't fix the root cause, but it will help you with confirming the root cause - you'll see the query plan, which should give you enough context. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services