From: | Steve Midgley <science(at)misuse(dot)org> |
---|---|
To: | adam <adhamm31(at)hotmail(dot)com> |
Cc: | postgres list <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: posgres optimizer not using the index on hstore HELP |
Date: | 2016-07-19 22:04:02 |
Message-ID: | CAJexoSJC9_en8GaF1knaznJd6HYnce6rObLWtz2yV4EcETO=SQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Mon, Jul 18, 2016 at 8:18 AM, adam <adhamm31(at)hotmail(dot)com> wrote:
> 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(at)hotmail(dot)com';
>
>
> when I hardcode the attribute like below it the index is used.
>
> select * from contact where contact_attributes->'EMAIL_ADDRESS' =
> "fqwefd(at)hotmail(dot)com';
>
> Maybe you can share an EXPLAIN ANALYZE for both queries?
Steve
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-07-19 22:06:50 | Re: posgres optimizer not using the index on hstore HELP |
Previous Message | adam | 2016-07-18 15:18:42 | posgres optimizer not using the index on hstore HELP |