Re: Index Tuning Features

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
Subject: Re: Index Tuning Features
Date: 2006-10-11 22:08:42
Message-ID: 452D6B6A.9090002@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Sullivan wrote:
> Just because I'm one of those statistics true believers, what sort of
> information do you think it is possible for the DBA to take into
> consideration, when building a hint, that could not in principle be
> gathered efficiently by a statistics system? It seems to me that
> you're claiming that DBAs can have magic knowledge.

Is one example is the table of addresses clustered by zip-code
and indexes on State, City, County, etc?

The current statistics systems at least see no correlation between
these fields (since the alphabetical ordering of cities and
numbering of postal codes is quite different). This makes the
planner under-use the indexes because it sees no correlation and
overestimates the number of pages read and the random accesses
needed.

However since San Francisco, CA data happens to be tightly packed
on a few pages (since it shares the same few zip codes), few
pages are needed and mostly sequential access could be used
when querying SF data -- though the optimizer guesses most pages
in the table may be hit, so often ignores the indexes.

Now I'm not saying that a more advanced statistics system
couldn't one-day be written that sees these patterns in the
data -- but it doesn't seem likely in the near term. DBA-based
hints could be a useful interim work-around.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2006-10-11 22:18:31 Re: Index Tuning Features
Previous Message Theo Schlossnagle 2006-10-11 22:06:33 Re: Upgrading a database dump/restore