Re: Partial aggregates pushdown

Поиск
Список
Период
Сортировка
От Alexander Pyhalov
Тема Re: Partial aggregates pushdown
Дата
Msg-id f47c4cb0965a8de2a19322970e7ba7e3@postgrespro.ru
обсуждение исходный текст
Ответ на Re: Partial aggregates pushdown  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Partial aggregates pushdown  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Bruce Momjian писал 2023-06-20 03:42:
> Apologies for the delay in my reply to this email.  I looked into the
> existing code and I found three things:
> 
> 1)  PQserverVersion() just pulls the conn->sversion value from the
> existing connection because pqSaveParameterStatus() pulls the
> server_version sent by the backend;  no need to issue SELECT version().
> 
> 2)  postgres_fdw already has nine calls to GetConnection(), and only
> opens a connection if it already doesn't have one.  Here is an example:
> 
>     /* Get the remote estimate */
>     conn = GetConnection(fpinfo->user, false, NULL);
>     get_remote_estimate(sql.data, conn, &rows, &width,
>                 &startup_cost, &total_cost);
>     ReleaseConnection(conn);
> 
> Therefore, it seems like it would be near-zero cost to just call conn =
> GetConnection() and then PQserverVersion(conn), and 
> ReleaseConnection().
> You can then use the return value of PQserverVersion() to determine if
> you can push down partial aggregates.
> 

Hi.
Currently we don't get remote connection while planning if 
use_remote_estimate is not set.
Such change would require to get remote connection in planner, not in 
executor.
This can lead to change of behavior (like errors in explain when user 
mapping is wrong - e.g. bad password is specified).
Also this potentially can lead to establishing connections even when 
plan node is not actually used
(like extreme example - select sum(score) from t limit 0).
I'm not saying we shouldn't do it - just hint at possible consequences.

-- 
Best regards,
Alexander Pyhalov,
Postgres Professional



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

Предыдущее
От: Will Mortensen
Дата:
Сообщение: [PATCH] doc: add missing mention of MERGE in MVCC
Следующее
От: Jeff Davis
Дата:
Сообщение: collation-related loose ends before beta2