Oracle AWR - high SQL Parse Calls but 0 Executions

不羁的心 提交于 2019-12-06 05:54:08

问题


I'm trying to understand what is causing an open query on an Oracle (10) database.

On AWR it shows a very high number of parse calls (e.g. 15,000+ in a 1 hour period), but 0 executions.

How it can the query not be executed, but then parsed 15000 times?

Parse Calls : 15,000+

Executions : 0

SQL Text : select * from AVIEW


回答1:


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




回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/30394077/oracle-awr-high-sql-parse-calls-but-0-executions

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