Re: question about index cost estimates

From: Jeff Hoffmann <jeff(at)propertykey(dot)com>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: question about index cost estimates
Date: 2000-05-18 04:49:23
Message-ID: 39237653.DD5BE596@propertykey.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hiroshi Inoue wrote:
>
> > -----Original Message-----
> > From: pgsql-hackers-owner(at)hub(dot)org [mailto:pgsql-hackers-owner(at)hub(dot)org]On
> > Behalf Of Jeff Hoffmann
> >
>
> [snip]
>
> >
> > pages_fetched = ceil(baserel->pages * log(tuples_fetched /
> > baserel->pages + 1.0));
> >
>
> Unfortunately I didn't understand this well either.
>
> pages_fetched seems to be able to be greater than
> baserel->pages.

not only does it seem that way, you can expect it to happen fairly
frequently, even if you're pulling only 1-2% of the records with a
query. if you don't believe it, check the actual performance of a few
queries.

> But if there's sufficiently large buffer
> space pages_fetched would be <= baserel->pages.
> Are there any assupmtions about buffer space ?
>

the # of pages fetched would be the same, it'd just be cheaper to pull
them from the buffer instead of from disk. that's what isn't being
taken into consideration properly in the estimate.

the real question is what assumptions can you make about buffer space?
you don't know how many concurrent accesses there are (all sharing
buffer space). i also don't think you can count on knowing the size of
the buffer space. therefore, the buffer space is set to some constant
intermediate value & it is taken account of, at least in the
cost_nonsequential_tuple.

the question is this: shouldn't you be able to make an educated guess at
this by dividing the total buffer space allocated by the backend by the
number of postmaster processes running at the time? or don't you know
those things?

jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-05-18 05:02:28 Re: question about index cost estimates
Previous Message Jeff Hoffmann 2000-05-18 04:32:55 Re: question about index cost estimates