Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cU7Bg-0007qU-AF for pgsql-general@arkaria.postgresql.org; Thu, 19 Jan 2017 07:31:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cU7Bf-0008IF-QL for pgsql-general@arkaria.postgresql.org; Thu, 19 Jan 2017 07:31:11 +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_2) (envelope-from ) id 1cU79M-0005fs-Iu for pgsql-general@postgresql.org; Thu, 19 Jan 2017 07:28:48 +0000 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cU79J-0004ud-5e for pgsql-general@postgresql.org; Thu, 19 Jan 2017 07:28:48 +0000 Received: by mail-lf0-x22f.google.com with SMTP id v186so29202759lfa.1 for ; Wed, 18 Jan 2017 23:28:44 -0800 (PST) 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; bh=oxZWvKky+38DaGWPamG3OpArDJC5ROl2QeoiUojJgJ0=; b=yRmL6iY9lal6aIs+n7Gmx0z/SGLq0hY0Vj7NhpZQPqku5UIpgqLBYWuXYpAcIR9/eI +gN9Qo5TMpVSP1RZ5PcljsVybbRUCxMo457JTPistAOOohrrIT0WaCZG3DFJD+kQe1jE XSXg8o4X1sxQ4FcCcgGuGquAkZOTm0frEBBFObNzpOdC7RTLI9J9MedDwWuCFkzs4DxK 88VnIuxK13PTtCTvGrQW3ujHv/y5Vta9mtIbZ9YMAHvtVKilNEMpgY1+q8T4RsS9W+zs RyrhS/qDwe9gjCEZyWn7hGOmgG7t/MGq5BZbJC/ljunXM3mkkHG8L5PG+D3w75dWuE0o fUDA== 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; bh=oxZWvKky+38DaGWPamG3OpArDJC5ROl2QeoiUojJgJ0=; b=NnL3o36HsPPYICYQMzx11DjUOi60RL64qKlCoT1UA403H0tKFhzgbMPLDpmjcISgSw xNf6RTYrlO1j3gVYgDaPtA/xhiE/cx+JLeAvsNMtvyahgSCRxSDxtRvELxfeRe/ZvGpT ZZnHAdynptMrA0qck3KLvIny8eDtMMNu6cu40HW16DJYAwbIaKYiSRwA9NcGzxwH24UG nNtXnxNMbcdIDXEj/m/wAA/O/V1SS5OOxTJXH2dV8zLwLRw/9yt9RI/l4cACKdwIGaQw 8B7IHvTEiBAGCB6rwNeWShYH6TRPwYHVmMjYu/vhdKixQrdXb8DBw4GWWlcoSgBNeoN5 Zazw== X-Gm-Message-State: AIkVDXJ+xMvm5d/Wrvzo4dJ8rK8FbVyd7UOIvk6zqwOacDRyWmje1wzsN0SAIv2+Za9iWYKk+NcvvprIJlCVJRMkpOhOL+y7Mcr88VNXqaMzgDE2nVie9xlCn+6Zlw5mecsh0ZTbPtHlxkHtYQgqHMnVl7VzQ2FXrDOF7TX+NbBM89ZdcJKDm+PXzshUc4XSzyQwLkw6OGav X-Received: by 10.46.72.10 with SMTP id v10mr3633166lja.46.1484810923374; Wed, 18 Jan 2017 23:28:43 -0800 (PST) Received: from [10.137.2.17] (ip-89-177-46-65.net.upcbroadband.cz. [89.177.46.65]) by smtp.gmail.com with ESMTPSA id a138sm1255130lfb.2.2017.01.18.23.28.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 23:28:42 -0800 (PST) Subject: Re: Queries are taking way longer in 9.6 than 9.5 To: Merlin Moncure , Adrian Klaver References: <70190c66-cf64-4741-1cd7-a6cf08f4101f@2ndquadrant.com> Cc: Melvin Davidson , Ravi Tammineni , Chris Mair , "pgsql-general@postgresql.org" From: Tomas Vondra Message-ID: Date: Thu, 19 Jan 2017 08:28:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 01/19/2017 06:21 AM, Merlin Moncure wrote: > ... > > yes. Either way, I would like to very much understand how server is > preferring 3m cost plan to 2.6k cost plan or is otherwise unable to > access the cheap plan. > Perhaps it doesn't even see the 2.6k cost - it may not generate the plan for some reason, or it arrives to different estimates. The OP was repeatedly asked for details of the configuration, I've even sent a query for doing that a few days back. It's difficult to help when such basic info is not provided, though. It'd also be interesting to see the statistics for the tables involved, so something like SELECT * FROM pg_stats WHERE tablename IN (... tables ...) and SELECT relname, relpages, reltuples, relallvisible FROM pg_class WHERE relame IN (... tables ...) might shed some light on what the planner assumes about the data. Of course, there are other things we might need to know. For example if there are foreign keys between the tables, 9.6 is using that for the estimates (unlike 9.5). And so on. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general