Re: Why does it not use the index?

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: philip(at)tildesoftware(dot)com
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why does it not use the index?
Date: 2003-07-21 19:06:38
Message-ID: m3n0f7aedd.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Philip Greer <philip(at)tildesoftware(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-07-21 19:11:24 Re: Why does it not use the index?
Previous Message Richard Huxton 2003-07-21 19:04:37 Re: Why does it not use the index?