Re: PassDownLimitBound for ForeignScan/CustomScan [take-2]

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: PassDownLimitBound for ForeignScan/CustomScan [take-2]
Дата
Msg-id CA+TgmoaiDhoUeFWHyrT7N_5TCvUCWw8XhJ8Ewg3EuTBqPNevvg@mail.gmail.com
обсуждение исходный текст
Ответ на PassDownLimitBound for ForeignScan/CustomScan [take-2]  (Kouhei Kaigai <kaigai@ak.jp.nec.com>)
Ответы Re: PassDownLimitBound for ForeignScan/CustomScan [take-2]
Список pgsql-hackers
On Mon, Oct 31, 2016 at 10:20 AM, Kouhei Kaigai <kaigai@ak.jp.nec.com> wrote:
> As an example, I enhanced postgres_fdw to understand the ps_numTuples
> if it is set. If and when remote ORDER BY is pushed down, the latest
> code tries to sort the entire remote table because it does not know
> how many rows to be returned. Thus, it took larger execution time.
> On the other hands, the patched one runs the remote query with LIMIT
> clause according to the ps_numTuples; which is informed by the Limit
> node on top of the ForeignScan node.

So there are two cases here.  If the user says LIMIT 12, we could in
theory know that at planner time and optimize accordingly.  If the
user says LIMIT twelve(), however, we will need to wait until
execution time unless twelve() happens to be capable of being
simplified to a constant by the planner.

Therefore, it's possible to imagine having two mechanisms here. In the
simple case where the LIMIT and OFFSET values are constants, we could
implement a system to get hold of that information during planning and
use it for whatever we like.   In addition, we can have an
execution-time system that optimizes based on values available at
execution (regardless of whether those values were also available
during planning).  Those are, basically, two separate things, and this
patch has enough to do just focusing on one of them.

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



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Incorrect overflow check condition for WAL segment size
Следующее
От: Robert Haas
Дата:
Сообщение: Re: PassDownLimitBound for ForeignScan/CustomScan [take-2]