Oracle AWR - high SQL Parse Calls but 0 Executions

半腔热情 提交于 2019-12-04 09:28:12

The * in the SQL would explain the repeated parsing. You should replace it with a list of field names.

Atmega

Oracle 11, java, jdbc 11.2.0.3

Problem occurs when you getting sequence from insert like this

PreparedStatement ps = connection.prepareStatement(QUERY, new String[] { "student_id" });

We found that jdbc driver prepares "SELECT * FROM " statement before every insert. There is only parse operation without execution.

T4CConnection.doDescribeTable

T4CStatement localT4CStatement = new T4CStatement(this, -1, -1);
localT4CStatement.open();
String str1 = paramAutoKeyInfo.getTableName();
String str2 = new StringBuilder().append("SELECT * FROM ").append(str1).toString();
localT4CStatement.sqlObject.initialize(str2);

Oracle parser doesn't cache parsed queries with "*" so there is additional parse operation per every insert.

Zero executions indicates that the query did not complete within the AWR snapshot

We have a similar issue, but the query was slightly different:

select col1, col2, col3 from table

Result was the same. A high parse rate but zero executions.

The reason was StatementCreatorUtils#setNull from spring-jdbc. ver 4.2.7 When executing:

insert into table (col1, col2, col3) values (val1, null, null)

there was a call to the database for a parameter type.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!