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 1ikYiT-0000H0-Kb for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2019 19:22:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikYiS-0002SC-D3 for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2019 19:22:36 +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 1ikYiS-0002S5-34 for pgsql-bugs@lists.postgresql.org; Thu, 26 Dec 2019 19:22:36 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ikYiP-0008MH-F1 for pgsql-bugs@lists.postgresql.org; Thu, 26 Dec 2019 19:22:35 +0000 Received: by mail-qk1-x736.google.com with SMTP id a203so20412390qkc.3 for ; Thu, 26 Dec 2019 11:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MJcTJQun66vUMFyRb9OAuSHBSiaUzFevF/QSOZtRTh8=; b=DjsNMibapHhkjGubmJf88Iq7ASD5vG5JqTJCHZivSa6pBpD9vV9tTZCQ8AVRrtk+uL fnOUeBevRlBPX6S00WFzCs6truXzp4FgsJYahYnforesbLJCiTBbubefsEFTz8o+yGUP WGNpr3aqXvxyi7/QaF9SGFVVg3tYJmljXHqIQaGQ2NVvb/nVaTcJcK6+oydmyCWJA9Ke jNpIaS//dEB4f+Hm6hLZip5K4dH3mZsBCMDENwE+CB3p8p4KOwVwfUqQdpKp5RCJT/jv GWL2UCAYDQZSy8Bkd62YDh1GGA2xqhVeCS/LuyJmGQMSGL2c6BuUvPRNK7lhGhj33O2Y z4lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MJcTJQun66vUMFyRb9OAuSHBSiaUzFevF/QSOZtRTh8=; b=GBhvIMqVABwGCwmMOCW19CzppZvTXttmki/7S/ZV4akDkbtB/k52ah2LRiAUWqiecv Vxd6K1L18t7kyBDLjh7PO5DwTYzIuaPOnm1PDzipiVf5+qQ3Dcmla4xxvJ10ZXDhihqw a0bianx6Nil0cu26gsC3OOZQLYoE1K4WUR78fDo77Ly3n+FFxQNVrNcuw44as3lQv8Rq o/ZXqDjaeR8fXZnGbz9HA3ws7MBaOHdyBcPlxRi9vPEJozYJV8ayA0dFd8XxaT6EQZSb BzngREcO8HR6ixjAm2xdISI2M5HwzkAF039Q5iBJ345ESHFL/U58vphIYat6ebm/wEek HrGw== X-Gm-Message-State: APjAAAXoK/cgektuNSMk2bOdoBVJrAld/nrdvknYx43Rblzw2MskrNqE 9FdWNc5dDS8RDwy/44v6qXM= X-Google-Smtp-Source: APXvYqzC11RVUUuw6jYHOpjBXW0FCaFomHQndRaL3aPLQVuQpcW0nYiTnIMU//hqAbtD0MwAebhfDA== X-Received: by 2002:a05:620a:1030:: with SMTP id a16mr38977522qkk.1.1577388151554; Thu, 26 Dec 2019 11:22:31 -0800 (PST) Received: from [10.8.0.6] (pool-173-79-120-3.washdc.fios.verizon.net. [173.79.120.3]) by smtp.gmail.com with ESMTPSA id d26sm8882016qka.28.2019.12.26.11.22.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Dec 2019 11:22:31 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: Indexing on JSONB field not working From: Zhihong Zhang In-Reply-To: <4910.1577386715@sss.pgh.pa.us> Date: Thu, 26 Dec 2019 14:22:30 -0500 Cc: Jeff Janes , Tomas Vondra , pgsql-bugs Content-Transfer-Encoding: quoted-printable Message-Id: <0A83C661-EDBB-43C8-9CBB-FB1E321A15CB@gmail.com> References: <0cf001d5b77f$bfe47e10$3fad7a30$@gmail.com> <20191220223005.f6w4ff4kdbgtanpz@development> <83E6A3F7-B1B4-4AD6-905A-BE11D244D35A@gmail.com> <4910.1577386715@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3608.40.2.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I simply ran =E2=80=98analyze;=E2=80=99 without table name and I assume = that analyzes everything. I just ran =E2=80=98analyze assets;=E2=80=99 = again but still no stats on indexes. I looked at pg_stats for all our databases. None of them have stats on = indexes. Are there any settings disabling this? Thanks! Zhihong > On Dec 26, 2019, at 1:58 PM, Tom Lane wrote: >=20 > Zhihong Zhang writes: >> The index name is correct and I ran =E2=80=98analyze' multiple times = since the index is created. I have dozen indexes, some are created when = table is created. None of them is in pg_stats. >=20 > You still haven't shown us exactly what you're doing, only asserted = that > you're doing the right thing, which seems somewhat unlikely given that > nobody has been able to reproduce this behavior based on what you've > told us so far. >=20 > One possible gotcha is indicated by this comment in analyze.c: >=20 > * Open all indexes of the relation, and see if there are any = analyzable > * columns in the indexes. We do not analyze index columns if = there was > * an explicit column list in the ANALYZE command, however. If we = are >=20 > that is, if you did something like "ANALYZE assets(_doc);" it would > not result in creation of stats for any expression indexes. >=20 >> The database is on AWS RDS. Does that make any difference? >=20 > Wouldn't have thought that their version of Postgres deviates much > from community Postgres. If you were talking about Aurora or = Redshift, > I can't speak to what those do. >=20 > regards, tom lane