From: | Aron Podrigal <aronp(at)guaranteedplus(dot)com> |
---|---|
To: | Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Simple Query not using Primary Key Index |
Date: | 2017-02-06 23:43:29 |
Message-ID: | CANJp-yjj0pGjO36HNji0vxb0jySZn06nYip8-gP-Zc1hy+K=Uw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
After resetting all statistics it still opts for a Seq Scan. I went ahead
to test with creating another table and querying that, and it shows on that
test table to be using the index. So I wonder if there is anything else
that may effect the planner. is there a way I can dog into this and see the
steps the planner performs while deciding which ap to use?
Thanks!
On Mon, Feb 6, 2017, 6:33 PM Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
wrote:
> On 2/6/17, Podrigal, Aron <aronp(at)guaranteedplus(dot)com> wrote:
> > Hi,
> >
> > I noticed when I do a simple SELECT id FROM mytable WHERE id =
> > 'cb81d070-4213-465f-b32e-b8db43b83a25'::UUID Postgres does not use the
> > primary key index and opts for a Seq Scan.
> >
> > I of course did VACUUM ANALYZE and I have reset statistics But no sign.
> Is
> > there any particular thing I should be looking at?
>
> Postgres uses specified access methods according to table's statistics.
> If you have a small table, it is likely that Postgres uses SeqScan
> because it is similar or cheaper than IndexScan. That's why it can
> ignore existing indexes.
>
> --
> Best regards,
> Vitaly Burovoy
>
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-02-06 23:58:06 | Re: Simple Query not using Primary Key Index |
Previous Message | Vitaly Burovoy | 2017-02-06 23:33:20 | Re: Simple Query not using Primary Key Index |