Re: Simple Query not using Primary Key Index

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Podrigal, Aron" <aronp(at)guaranteedplus(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Simple Query not using Primary Key Index
Date: 2017-02-06 23:58:06
Message-ID: CAKFQuwaAn6N1G45A0eHoFrkuhA-Aq8RFiEY0HMzDm0asV7U5tA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 6, 2017 at 4:16 PM, 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?
>
>
​Can you prove that "mytable.id" is of type "uuid" and not "text"?

As asked, how big is mytable?

These are readily answered if you show the explain analyze results.

David J.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vitaly Burovoy 2017-02-07 00:03:19 Re: Simple Query not using Primary Key Index
Previous Message Aron Podrigal 2017-02-06 23:43:29 Re: Simple Query not using Primary Key Index