Re: I don't understand this - Mailing list pgsql-general

From Jan Wieck
Subject Re: I don't understand this
Date
Msg-id 200204292059.g3TKxF816559@saturn.janwieck.net
Whole thread Raw
In response to I don't understand this  (Uros Gruber <uros@sir-mag.com>)
List 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@Yahoo.com #



pgsql-general by date:

Previous
From: Denis Gasparin
Date:
Subject: Postgresql 7.1.3 faster than 7.2.1
Next
From: Vaclav Kulakovsky
Date:
Subject: Data integrity problem !!!