Re: Actual Cost

From: Donald Dong <xdong(at)csumb(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Actual Cost
Date: 2019-02-17 19:05:39
Message-ID: F843D386-5020-4A0F-BC1D-58550B2C7489@csumb.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Feb 17, 2019, at 10:56 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Perhaps, but refactoring to get that seems impractically invasive &
> expensive, since e.g. index AM cost estimate functions would have to
> be redefined, plus we'd have to carry around some kind of cost vector
> rather than single numbers for every Path ...

Maybe we could walk through the final plan tree and fill the expression? With another tree structure to hold the cost vectors.

On Feb 17, 2019, at 8:29 AM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> I don't think there is any way to assign an actual cost. For example how do you know if a buffer read was "actually" seq_page_cost or random_page_cost? And if there were a way, it too would have a high variance.

Thanks for pointing that out! I think it's probably fine to use the same assumptions as the cost model? For example, we assume 3/4ths of accesses are sequential, 1/4th are not.

> What would I find very useful is a verbosity option to get the cost estimates expressed as a multiplier of each *_cost parameter, rather than just as a scalar.

Yeah, such expression would also help if we want to plug in the actual values.

On Feb 17, 2019, at 4:11 AM, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
> Perhaps I'm just too used to comparing the rows/pages directly, but I
> don't quite see the benefit of having such "actual cost". Mostly because
> the cost model is rather rough anyway.

Yeah, I think the "actual cost" is only "actual" for the cost model - the cost it would output given the exact row/page number. Some articles/papers have shown row estimation is the primary reason for planners to go off, so showing the actual (or the updated assumption) might also be useful if people want to compare different plans and want to refer to a more accurate quantitative measure.

regards,
Donald Dong

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-02-17 19:27:20 Re: allow online change primary_conninfo
Previous Message Tom Lane 2019-02-17 18:56:23 Re: Actual Cost