Re: Why does it not use the index? - Mailing list pgsql-general

From Doug McNaught
Subject Re: Why does it not use the index?
Date
Msg-id m3n0f7aedd.fsf@varsoon.wireboard.com
Whole thread Raw
In response to Why does it not use the index?  (Philip Greer <philip@tildesoftware.com>)
List pgsql-general
Philip Greer <philip@tildesoftware.com> writes:

> WTF? Why would a vacuum be necessary in order for it to start using the index?

It's not the VACUUM that's necessary; it's the ANALYZE.  The query
planner uses table statistics to make its decisions, and ANALYZE is
what collects those statistics.  Without an ANALYZE the planner will
make default assumptions that are rarely correct.  :)

VACUUM should also be run regularly, of course.

-Doug

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Why does it not use the index?
Next
From: Stephan Szabo
Date:
Subject: Re: Why does it not use the index?