From: | Nicola Zanaga <NZanaga(at)efsw(dot)it> |
---|---|
To: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | R: Slow performance updating CLOB data |
Date: | 2016-07-18 08:13:59 |
Message-ID: | 47856758BAE4794A9EC4FCA2E63FC85E370593D0@exchange.intranet.efsw.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Here a snippet:
Properties props = new Properties();
props.put("user", "test1");
props.put("password", "test1");
Connection connection = java.sql.DriverManager.getConnection("jdbc:postgresql://<server>", props);
Statement st = connection.createStatement();
st.execute("CREATE TABLE TestClob1 (id int8 NOT NULL, data TEXT, PRIMARY KEY(id))");
st.close();
st = connection.createStatement();
st.execute("INSERT INTO TestClob1 (id) VALUES (1) ");
st.close();
st = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet resultSet = st.executeQuery("SELECT id, data FROM TestClob1 WHERE id = 1 ");
resultSet.next();
resultSet.updateCharacterStream(2, new StringReader("hello"), "hello".length());
resultSet.updateRow();
resultSet.close();
Da: Nicola Zanaga
Inviato: domenica 17 luglio 2016 11:39
A: pgsql-jdbc(at)postgresql(dot)org
Oggetto: Slow performance updating CLOB data
Hi, using ResultSet.updateCharacterStream to update a CLOB is very slow.
Most of the time is spent in method PgResultSet.isUpdateable because the table has a primary key but doesn't have a "oid" column.
So the code tries to get primary keys from the query, using getMetaData().getPrimaryKeys.
This is a very slow process.
There is any workaround ?
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2016-07-18 08:43:32 | Re: Slow performance updating CLOB data |
Previous Message | Thomas Kellerer | 2016-07-17 16:42:21 | Re: Slow performance updating CLOB data |