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 1ikW2J-0002Xh-JW for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2019 16:30:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikW2G-0000jw-Jo for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Dec 2019 16:30:52 +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 1ikW2G-0000jp-5x for pgsql-bugs@lists.postgresql.org; Thu, 26 Dec 2019 16:30:52 +0000 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ikW2D-0001P7-Ti for pgsql-bugs@lists.postgresql.org; Thu, 26 Dec 2019 16:30:51 +0000 Received: by mail-qv1-xf29.google.com with SMTP id n8so9189552qvg.11 for ; Thu, 26 Dec 2019 08:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=s3Ko7xFEc3zgP7V595fKDafGQ6Jby3zqpJ3u1M3GyrU=; b=OC7gmOvbBjaNPsYILsDO2z+FUrKxS4GymeV94ZFr45BXxvmfTab+ticetrQnH6mAAO wcUxv8D1aKSg0O0yR7P3+twsZAYOA7Nw2iGzi3fLJed62+tFEToG5/zFawC0Pl2UtTtn GvoR0ebDFDcEIasqAYIQmA9mIizoEgXJ6etd2JQd+jJiPGIwywwOSXfdqZP8viEuNEx3 zinkDaG1Q8yxVnWmL2vHDp4ZLHjI4yVhobrmYwFzlviBu9QVsDYviDmmosG7ufdpsjTT r0jLwvOqy8WYbFWaaE1eYCBDjgl5rwDhfbO2lKxltsPzOXK7WuU+H1EXGedqctlLcgDs W36Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=s3Ko7xFEc3zgP7V595fKDafGQ6Jby3zqpJ3u1M3GyrU=; b=Tah7dQ85ushUyrFNxmLuqzC8rQ0yYlQrHW5v7A9s8TP9mAqCZEauwUElh2ubek83i4 53r6s4R8qTdYAVCEq3Dp95JXSWUDSAaiuwRF9xGoK5+VN5ZQYv1+BWdEx9kZY7lUqiaa nnUOLjy4ZD5emImc1nHWcdBESIeRCvHGum/H+vOlQLhZ/lmC9Cqc+9ceRF5HCgMUnBTd ICNWiz5TCwiqGp3fn+7/LS15t5S+MrnjnVyCVdTzxlX85oqqb5bDO7yKQrl0s0lmGvJa +vg1nzKnkM2Zzvylm48oN2s8P4tU977/UAXZX/tnnK87G20e1OHsccMAtVo63jZ/DqFx 4QGQ== X-Gm-Message-State: APjAAAXUbiBD644kZCHxVX+f4f3NNvVjjUZeOdbaRJoMuzdgytIDOd7G OvKdS/wlai77nTNb/EsndYc= X-Google-Smtp-Source: APXvYqw/CWxwFSyJSXHIBPljhJxjAZ2Cc0tTQKJ2rRIHIAu894NxZDgRGvFIfM3yIPLiAIZadl0RWQ== X-Received: by 2002:a0c:9c86:: with SMTP id i6mr36801033qvf.214.1577377848432; Thu, 26 Dec 2019 08:30:48 -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 q25sm8884100qkq.88.2019.12.26.08.30.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Dec 2019 08:30:47 -0800 (PST) From: Zhihong Zhang Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_5C3F2CAF-14D2-4602-96C9-0B84552FC976" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: Indexing on JSONB field not working Date: Thu, 26 Dec 2019 11:30:47 -0500 In-Reply-To: Cc: Tomas Vondra , pgsql-bugs To: Jeff Janes References: <0cf001d5b77f$bfe47e10$3fad7a30$@gmail.com> <20191220223005.f6w4ff4kdbgtanpz@development> X-Mailer: Apple Mail (2.3608.40.2.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_5C3F2CAF-14D2-4602-96C9-0B84552FC976 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 That command yields nothing. If I use the tablename =E2=80=98assets=E2=80=99= , it only returns stats on columns, nothing about indexes. The indexed = field is in JSONB field =E2=80=98_doc=E2=80=99. This is the stats on the = column, select * from pg_stats where tablename=3D'assets' and attname=3D'_doc'; schemaname | tablename | attname | inherited | null_frac | avg_width | = n_distinct | most_common_vals | most_common_freqs | histogram_bounds | = correlation | most_common_elems | most_ common_elem_freqs | elem_count_histogram = ------------+-----------+---------+-----------+-----------+-----------+---= ---------+------------------+-------------------+------------------+------= -------+-------------------+------ ------------------+---------------------- public | assets | _doc | f | 0 | 18 | = -1 | | | | = | | | (1 row) Let me know if you want any other information. Zhihong > On Dec 21, 2019, at 10:17 AM, Jeff Janes wrote: >=20 > Can you show the output of: >=20 > select * from pg_stats where tablename =3D'float_number_index_path2' >=20 > For readability, use the output format which shows the columns down = the screen, not across. In psql, that would toggled on with \x. >=20 --Apple-Mail=_5C3F2CAF-14D2-4602-96C9-0B84552FC976 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 That = command yields nothing. If I use the tablename =E2=80=98assets=E2=80=99, = it only returns stats on columns, nothing about indexes. The indexed = field is in JSONB field =E2=80=98_doc=E2=80=99. This is the stats on the = column,

select =
* from pg_stats where tablename=3D'assets' and attname=3D'_doc';
schemaname | tablename | = attname | inherited | null_frac | avg_width | n_distinct | = most_common_vals | most_common_freqs | histogram_bounds | correlation | = most_common_elems | most_
common_elem_freqs | elem_count_histogram
------------+-----------+---------+-----------+-----------+----= -------+------------+------------------+-------------------+--------------= ----+-------------+-------------------+------
------------------+----------------------
public | assets | _doc = | f | 0 | 18 | -1 | | = | | | = |
|
(1 row)
Let me know if you want any other = information.

Zhihong


On Dec 21, 2019, at 10:17 AM, Jeff Janes <jeff.janes@gmail.com> wrote:

Can = you show the output of:

select = * from pg_stats where tablename =3D'float_number_index_path2'

For readability, use the output format which shows the = columns down the screen, not across.  In psql, that would toggled = on with \x.


= --Apple-Mail=_5C3F2CAF-14D2-4602-96C9-0B84552FC976--