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 1i3LD8-0005En-IT for pgsql-admin@arkaria.postgresql.org; Thu, 29 Aug 2019 14:15:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i3LD7-0003Vw-EY for pgsql-admin@arkaria.postgresql.org; Thu, 29 Aug 2019 14:15:37 +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 1i3LD7-0003Vo-34 for pgsql-admin@lists.postgresql.org; Thu, 29 Aug 2019 14:15:37 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3LD4-0007LQ-SQ for pgsql-admin@postgresql.org; Thu, 29 Aug 2019 14:15:36 +0000 Received: by mail-io1-xd35.google.com with SMTP id b10so7262037ioj.2 for ; Thu, 29 Aug 2019 07:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:date:subject:message-id :to; bh=kxzsG3cGInW93C0JFUAsM80OFyLsmArzTaV2KzjV2ME=; b=mEWaoEj3XmM/dP4kTAxgSESpUJjlb7lqPegiPrLB35S5tLl2SldYwlM3zIEnDppbDy e0fih2aln8qNsmHb/XWS6EgaWrO/ajBCK1vxzOEXQlOBqQr3cBokHqWjbPGrroZSYIbW 7liZbmZVBwBi/n0kq7Q4wIul7Mq2wRhXqTALH3Y2oLYC+k0+ooC1eYTMpJ3zkFJ4VSxq lAAYfovPBEZ9BoLOBpSONPZA/DwllzKim/3vyVBNCu4eysi7wycMDypmAGjSq7tGfwgo lXZhqlhIKLO9k/OeMQ4BWLpC/58HFz3fIYYWJnnCnz+vti0DjGYvSlvtuGJDDbUlFUtn w7+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version:date :subject:message-id:to; bh=kxzsG3cGInW93C0JFUAsM80OFyLsmArzTaV2KzjV2ME=; b=pYLShuke+MZhQRm46I/gIxZrQUN+7YrDxgv4HGgGcYSUxsqLh0nakHekVcrWTn0j84 79F3Yvi33WZCUA9j8XQkaJUlTT4mQSp1CzTtUJe/wB757qfvfwpe17pD5ln8fw3MxzA4 qx18Ght9KPl0nVsYnxQXZu9l2txDcsKpuylnhmt81O4AB+CO7QH/rm+QxHKYKT21/SKj 1lPtmVgRxqXqQAixzHEhUlXNyYvZ1sBL/h5r+T+Y7O+dU2c3QITpuFb195UhExI37u8i e3PRyYMtTaVHrSwhFiRUCMlKY9ahjHOVxdROKI6Id7q4xHqnS1PyOY8m4Y6Y1NG/DFBe 9rZA== X-Gm-Message-State: APjAAAU02s7YK6F2d1ogYn7WEVnZ39tDKRsaAh7y5NvcgqhWsskNor9y C3fE69vUPEmz9imp4KTvUuOs4kPv X-Google-Smtp-Source: APXvYqxEYrGePQlwqQK5Mqcvfel+VAChRx4zc86ByBqmaRXFWW4p7STjw/U6ljPZkqTF7Ogf3ENVpA== X-Received: by 2002:a6b:bd46:: with SMTP id n67mr11168496iof.181.1567088132392; Thu, 29 Aug 2019 07:15:32 -0700 (PDT) Received: from [172.17.53.230] (rouge-137-188-108-19.vzw.com. [137.188.108.19]) by smtp.gmail.com with ESMTPSA id a6sm2432724ios.20.2019.08.29.07.15.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 07:15:31 -0700 (PDT) From: John Scalia Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Thu, 29 Aug 2019 10:15:28 -0400 Subject: Index not always being used Message-Id: <180F96D3-690E-466E-B73E-F6B34C6409C7@gmail.com> To: pgsql-admin@postgresql.org X-Mailer: iPad Mail (16G102) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I=E2=80=99ve got a table with approximately 5.5 million rows, and one column= that is frequently searched is of type varchar(50) and we just put a trigr= am index on it. Now, if we search =E2=80=9Cwhere bld_city =3D =E2=80=98baski= ngridge=E2=80=99=E2=80=9D, explain says a sequential table scan is going to b= e used, but if I change the query to use =E2=80=9Cwhere bold_city like =E2=80= =98basking%=E2=80=99=E2=80=9D, then explain correctly shows that a bitmap in= dex scan will be performed. Why would these two forms use different approach= es? I=E2=80=99m a bit confused. =E2=80=94 Jay Sent from my iPad=