Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver

Поиск
Список
Период
Сортировка
От Vladimir Sitnikov
Тема Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver
Дата
Msg-id CAB=Je-GOicmnV00aToC1Gvt4GMZBwj2psLO5AnQamK4b=-c1hA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
>On the Java side, that means invoking PreparedStatement::setBinaryStream TWICE for the same data.


AFAIK, frontend-backend protocol allows to reuse $1 multiple times in the same query, so it seems to be indeed a bit efficient to use

values($1, $2, $3) on conflict.... set file_data=$1, file_name=$2

kind of query.

Obviously, you can use pl/pgsql procedure to workaround that. At least that would optimize network traffic.


AFAIK, JDBC references parameters by parameter position, so there's no implementation-independent way to reuse the same parameter without it sending it twice over the wire.


Vladimir

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: [JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver
Следующее
От: Christopher BROWN
Дата:
Сообщение: Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver