[JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQL JDBC driver

Поиск
Список
Период
Сортировка
От Christopher BROWN
Тема [JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQL JDBC driver
Дата
Msg-id CAHL_zcOaWb2wuTX0eVnVXie0LhDjdZgvX0xR1PZ1GX2sM-8Ovw@mail.gmail.com
обсуждение исходный текст
Ответы Re: [JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Dave Cramer <pg@fastcrypt.com>)
[JDBC] Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQL JDBCdriver  (Thomas Kellerer <spam_eater@gmx.net>)
Re: [JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Brad DeJong <Brad.Dejong@infor.com>)
Re: [JDBC] Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Brad DeJong <Brad.Dejong@infor.com>)
Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Dave Cramer <pg@fastcrypt.com>)
Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQL JDBCdriver  (Thomas Kellerer <spam_eater@gmx.net>)
Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Brad DeJong <Brad.Dejong@infor.com>)
Re: Efficient use of ON CONFLICT DO UPDATE with the PostgreSQLJDBC driver  (Brad DeJong <Brad.Dejong@infor.com>)
Список pgsql-jdbc
Hello,

I've at last had an opportunity to use PostgreSQL 9.6 (instead of 9.4) for a project, and have been able to use the ON CONFLICT DO UPDATE clause. As it can involve repeating parameter values (including, as is my case, large binary files), I'm wondering if there's any performance or resource-usage side effects (or workarounds) when doing something like this:

INSERT INTO foo (c_uuid, file_data, file_name) VALUES (?, ?, ?)
ON CONFLICT (c_uuid) DO UPDATE SET file_data = ?, file_name = ?

On the Java side, that means invoking PreparedStatement::setBinaryStream TWICE for the same data.

I'm not noticing side effects on localhost (but haven't profiled either).  Is this fine, or a potential problem?   Is there a better approach?

Thanks,
Christopher

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

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