Re: I don't understand this

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Uros Gruber <uros(at)sir-mag(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: I don't understand this
Date: 2002-04-29 20:59:15
Message-ID: 200204292059.g3TKxF816559@saturn.janwieck.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Uros Gruber wrote:
> Hi!
>
> i create some table with primary key and one index key
> Then i insert data and try some explain on my select.
>
> it tells me that index was used.
>
>
> then i do some other queries and vacuum and when i try again
> SAME explain it prints that it was used Seq Scan
>
> It this normal or what. Or is some kind of a bug.

Yes, this is normal.

The statistics defaults for an un-vacuumed table usually
cause the optimizer to use an index scan. When you analyze
the table later, the statistics reflect the real status and
for very small tables, a sequential scan is normally better
than an index scan.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Frank Morton 2002-04-29 21:12:40 sybase db conversion
Previous Message Bruce Momjian 2002-04-29 20:50:36 July O'Reilly Open Source Convention