Re: Why is PostgreSQL 9.1 not using index for simple equality select

From: Yang Zhang <yanghatespam(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is PostgreSQL 9.1 not using index for simple equality select
Date: 2013-04-12 17:15:42
Message-ID: CAKxBDU-QW1mKbg36xi3ghXT23yJ-AqZ9=KgxhX=ZbRo4M5eAFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It's actually just `text`.

I updated my SO question with some more info including explain analyze
(no difference), \d,
and your last incantation.

Thanks!

On Fri, Apr 12, 2013 at 7:11 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Yang Zhang <yanghatespam(at)gmail(dot)com> writes:
>> db=> explain select * from lead where email = 'blah';
>> QUERY PLAN
>> ------------------------------------------------------------
>> Seq Scan on lead (cost=0.00..319599.38 rows=1 width=5108)
>> Filter: (email = 'blah'::text)
>> (2 rows)
>
> That's awfully odd. What data type is the "email" column?
>
> It seems possible also that the index on it is marked invalid. I'd have
> expected \d to tell you so, but maybe you're using a version of psql that
> doesn't know about that. It'd be interesting to look at
> select * from pg_index where indexrelid = 'index name here'::regclass;
>
>
> regards, tom lane

--
Yang Zhang
http://yz.mit.edu/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-04-12 17:24:02 Re: Why is PostgreSQL 9.1 not using index for simple equality select
Previous Message whiplash 2013-04-12 15:44:56 False unique constraint violation (exception block)