Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daU6X-0007xx-Up for pgsql-performance@arkaria.postgresql.org; Wed, 26 Jul 2017 21:44:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1daU6W-0000Tf-VX for pgsql-performance@arkaria.postgresql.org; Wed, 26 Jul 2017 21:44:29 +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 1daU6W-0000Pt-0U for pgsql-performance@postgresql.org; Wed, 26 Jul 2017 21:44:28 +0000 Received: from mail-oi0-x235.google.com ([2607:f8b0:4003:c06::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1daU6S-0004dN-OV for pgsql-performance@postgresql.org; Wed, 26 Jul 2017 21:44:26 +0000 Received: by mail-oi0-x235.google.com with SMTP id a9so91605078oih.0 for ; Wed, 26 Jul 2017 14:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RFz9nvNMpgK1mSKsN0l1v8YBkmg8ept+77FnyDZgYhI=; b=1e/kMAXCJ8WVF6qh/BNvpRq75rqQQl/u7tTtJJfwbC7rtJrvYyP4HZQHAzI2bZrY3d YE1KSWmgRzKb6u1VnUersCvfJDMAcFF0Kza9b7eNT+XcJ77L7OfZzPXJiHjmE4+IbmH3 QfBT84H+ua+7WpV4Pm87Jmc3qjc3Z8CTLuQLLOZnz6OC0E0XgGyAlxfMWhxNdbWHTD47 vJ9OfjdQMsodeGzUIqHtR79ELuXifo9ZhZQbsTGojhlyA00Hw9f2+ITJV56ZZjf0VsMS TKMe1kAHKwx0KxMvzCrbfNs3G31Y7GqSc3WN/WXYFNjObTpAl7OMQLjQP3wbDbiJMr32 RXPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RFz9nvNMpgK1mSKsN0l1v8YBkmg8ept+77FnyDZgYhI=; b=G0223qgR3/9WhNTl5xx9pvrs51sDyRnvqIVPAWoHgsNM+ep4IWdF1PpFyXMDAHa5VG FBiQyhoIZtnK21IbDAz1QQNkkpF0vnFHeaYo0Nj+ayn2x1Wq3HKhE0EvlhQOxZtR75LN BnRDK25co02tUuv8XKJkH36qvkkeWDbs3Ov7JFZx6vV9WcPXEjIs3kSILDCi2FZLFzb6 q3yrTMuOIaXU2srE24sjwBrPpxxLoNBggAXz3qX3au3a5riMN/Z2PrtCkTFKs3orc6Ic LuUBJC2wXa6xYboSP6ruTxqwOG5HGsTzkHShJqpi+SD8eli0eZDwqhUB4IvIkX7turjL cD0g== X-Gm-Message-State: AIVw1113R84stC+Xqfdu0j4Cr4jaCW+2sz1j5XncqtOHmA6c3ypo9j/8 MgOYFNegYVHg93q8cZ270zaq1Q98/usi X-Received: by 10.202.226.20 with SMTP id z20mr2289650oig.242.1501105463580; Wed, 26 Jul 2017 14:44:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.132.141 with HTTP; Wed, 26 Jul 2017 14:44:03 -0700 (PDT) In-Reply-To: References: From: Peter Geoghegan Date: Wed, 26 Jul 2017 14:44:03 -0700 Message-ID: Subject: Re: Slow query after 9.3 to 9.6 migration To: Daniel Blanch Bataller Cc: =?UTF-8?Q?Fl=C3=A1vio_Henrique?= , postgres performance list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Thu, Jan 5, 2017 at 9:51 AM, Daniel Blanch Bataller wrote: > If just recreating the index now it uses it, it might mean that the index > was bloated, that is, it grew so big that it was cheaper a seq scan. > > I=E2=80=99ve seen another case recently where postgres 9.6 wasn=E2=80=99t= using the right > index in a query, I was able to reproduce the issue crafting index bigger, > much bigger than it should be. > > Can you record index size as it is now? Keep this info, and If problem > happens again check indexes size, and see if they have grow too much. > > i.e. SELECT relname, relpages, reltuples FROM pg_class WHERE relname =3D > =E2=80=98index_name' > > This might help to see if this is the problem, that indexes are growing t= oo > much for some reason. Are these unique indexes or not? Did Flavio have a workload with many UPDAT= Es? I ask these questions because I think it's possible that this is explained by a regression in 9.5's handling of index bloat, described here: http://postgr.es/m/CAH2-Wz=3DSfAKVMv1x9Jh19EJ8am8TZn9f-yECipS9HrrRqSswnA@ma= il.gmail.com I'm trying to track down cases where this could be an issue, to get a better sense of the problem. --=20 Peter Geoghegan --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance