Re: [PERFORM] Query planner gaining the ability to replanning after start of query execution.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PERFORM] Query planner gaining the ability to replanning after start of query execution.
Дата
Msg-id 4276.1510613373@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PERFORM] Query planner gaining the ability to replanning afterstart of query execution.  (Oliver Mattos <omattos@gmail.com>)
Ответы Re: [PERFORM] Query planner gaining the ability to replanning afterstart of query execution.  (Oliver Mattos <omattos@gmail.com>)
Список pgsql-performance
Oliver Mattos <omattos@gmail.com> writes:
>> Can you be more elaborate how you'd want to go about it?

> ... If another candidate plan is now lower cost, the current plan would be
> terminated[1] by setting a flag instructing each execnode to return as
> if it had reached the end of the input, although still caching the
> node selectivity values, and the new plan started from scratch.

Quite aside from the implementation difficulties you'll have, that
approach is a show-stopper right there.  You can't just restart from
scratch, because we may already have shipped rows to the client, or
for DML cases already inserted/updated/deleted rows (and even if you
could roll those back, we've possibly fired triggers with unpredictable
side effects).  Queries containing volatile functions are another no-fly
zone for this approach.

I can't see any way around that without unacceptable performance costs
(i.e. buffering all the rows until we're done) or wire-protocol breakage.

I think that a more practical way to address the class of problems
you're talking about is to teach the planner to have some notion of
worst-case as well as expected-case costs, and then incorporate some
perhaps-configurable amount of risk aversion in its choices.
        regards, tom lane

PS: please do not top-post, and do not quote the entire darn thread
in each message.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

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

Предыдущее
От: Arne Roland
Дата:
Сообщение: Re: [PERFORM] Query planner gaining the ability to replanning afterstart of query execution.
Следующее
От: Oliver Mattos
Дата:
Сообщение: Re: [PERFORM] Query planner gaining the ability to replanning afterstart of query execution.