Re: [HACKERS] Linear vs. nonlinear planner cost estimates

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [HACKERS] Linear vs. nonlinear planner cost estimates
Дата
Msg-id CA+TgmoYBd7Vx1tMdCuhK9B7BTxHx6-_1x6QEohYkZxgVnWej4A@mail.gmail.com
обсуждение исходный текст
Ответ на [HACKERS] Linear vs. nonlinear planner cost estimates  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] Linear vs. nonlinear planner cost estimates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Dec 14, 2016 at 2:12 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I don't have a concrete proposal right now about how to fix this.  The
> most expansive response would be to decorate every path with an explicitly
> nonlinear cost function, which would need to be able to report the cost
> to fetch the first N tuples rather than the total scan cost.  That would
> be a lot of work though.

And it would have some significant overhead, I bet.

> Maybe we could make this work just by setting the startup cost of an
> indexscan differently.  We could redefine "startup cost" as "cost to fetch
> the first tuple and then stop", and compute that independently of the
> total cost for plan types where it'd matter.  That would fix the problem
> for LIMIT 1 cases, and even for cases with a larger limit, scaling
> linearly from that to the total cost would produce a better estimate than
> what we get now.  But it feels like it's still a band-aid.

I think that would be a good place to start.  I bet it would help
materially, and it's a lot less work than anything more sophisticated.
There are plenty of cases (semi joins, and many nested loops that are
not semi joins) where the number of rows that we expect to fetch is 1
or very close to 1; LIMIT 100 or LIMIT 1000 happens, but it's a lot
less common.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Creating a DSA area to provide work space for parallel execution
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Linear vs. nonlinear planner cost estimates