Re: The science of optimization in practical terms?

From: decibel <decibel(at)decibel(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Smith <gsmith(at)gregsmith(dot)com>, jd(at)commandprompt(dot)com, Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)pl>, Bernd Helmle <mailings(at)oopsware(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: The science of optimization in practical terms?
Date: 2009-02-21 00:25:41
Message-ID: 9D119CC4-0DB8-4144-A109-3032D9E77DB3@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Feb 17, 2009, at 11:23 PM, Robert Haas wrote:
>> Actually, a simple algorithm that might work really well would be to
>> calculate relation cache odds as ( number of page accesses for
>> relation /
>> number of page accesses for all relations ) * ( sum(relpages)*BLKSZ /
>> eff_cache_size ), where number of page accesses would be both from
>> relcache
>> and not.
>
> I don't think that formula makes any sense. If effective_cache_size
> is in the denominator, then increasing it will make the odds of
> finding the page in cache go down.

Yes, sorry... I got that part of the equation upside-down. It should be:

( number of page accesses for relation / number of page accesses for
all relations ) * ( eff_cache_size / sum(relpages)*BLKSZ )

>> One thing this doesn't address though is the report from a few
>> months ago that accessing small tables is still faster with an
>> index scan,
>> even if we know the whole thing is in cache (I don't remember if
>> that was
>> ever resolved...)
>
> I'm not sure if this is what you're referring to, but there was a
> relatively recent post on, I believe, -performance, where a bitmap
> index scan that hit almost the entire table beat out a seqscan. I
> don't think there was any further discussion and I'm still mystified
> as to how it's possible.

What I was thinking of was that when dealing with a very small table
(one or maybe a few pages), the planner thinks that a seqscan is the
fastest way to get a single row, but it's actually faster to use an
index. The bitmap case is even more interesting. Something is
seriously screwy with small seqscans it seems.
--
Decibel!, aka Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-02-21 01:19:05 Re: parallel restore
Previous Message Kris Jurka 2009-02-20 21:19:11 Re: [Pljava-dev] Re: Should creating a new base type require superuser status?