Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPcQc-00065j-Ac for pgsql-sql@arkaria.postgresql.org; Tue, 19 Jul 2016 21:19:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPcQb-00079e-SU for pgsql-sql@arkaria.postgresql.org; Tue, 19 Jul 2016 21:19:45 +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 1bPAJm-0005DE-O6 for pgsql-sql@postgresql.org; Mon, 18 Jul 2016 15:18:50 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPAJf-0006KE-7v for pgsql-sql@postgresql.org; Mon, 18 Jul 2016 15:18:49 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 242B42CB4541 for ; Mon, 18 Jul 2016 07:55:30 -0700 (PDT) Date: Mon, 18 Jul 2016 08:18:42 -0700 (MST) From: adam To: pgsql-sql@postgresql.org Message-ID: <1468855122279-5912464.post@n5.nabble.com> Subject: posgres optimizer not using the index on hstore HELP MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 0.0 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org I have a simple query select on the hstore attribute "EMAIL_ADDRESS". but the thing is i'm using a parameter in the query to specify which hstore attribute I want to access, and when using a parameter the index which I created is suppressed; whereas when I hard code the attribute "EMAIL_ADDRESS" then the index is used. this is the index I created: create index indx_email on contact using btree ((contact_attributes->'EMAIL_ADDRESS'::text)); the query is: select * from contact where contact_attributes->$parameter = "fqwefd@hotmail.com'; when I hardcode the attribute like below it the index is used. select * from contact where contact_attributes->'EMAIL_ADDRESS' = "fqwefd@hotmail.com'; -- View this message in context: http://postgresql.nabble.com/posgres-optimizer-not-using-the-index-on-hstore-HELP-tp5912464.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql