Parse statistic values don't seem to add up [message #685105] |
Sat, 23 October 2021 12:23 |
Andrey_R
Messages: 441 Registered: January 2012 Location: Israel
|
Senior Member |
|
|
Hi all,
I am trying to review parse statistics for a database.
When I check V$SYSSTAT with the following query, I get numbers that don't add up:
SQL> select name,value from v$sysstat where lower(name) like 'parse count%';
NAME VALUE
---------------------------------------------------------------- ----------
parse count (total) 44852
parse count (hard) 9321
parse count (failures) 34
parse count (describe) 48
SQL>
I tried to look up Oracle documentation but whatever I found couldn't explain the gap.
https://docs.oracle.com/en/database/oracle/oracle-database/18/refrn/V-SYSSTAT.html#GUID-250136E5-E07E-4A78-9F67-28C0D3C6E922
Questions
-------
1. How can the gap between sum of hard/failures/describe be explained ?
2. I tried to re-execute some query to make sure it's soft parsed:
SQL> var a number
SQL> exec :a := 1;
PL/SQL procedure successfully completed.
SQL> select :a from dual;
:A
----------
1
SQL> select :a from dual;
:A
----------
1
SQL> select :a from dual;
:A
----------
1
SQL> set autot on
SQL> select :a from dual;
:A
----------
1
Execution Plan
----------------------------------------------------------
Plan hash value: 1388734953
-----------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-----------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
-----------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
544 bytes sent via SQL*Net to client
624 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
I still don't see any soft parses in my V$SYSSTAT.
What am I missing ?
Thanks
Andrey
|
|
|
|
|
|
Re: Parse statistic values don't seem to add up [message #686313 is a reply to message #686312] |
Sat, 23 July 2022 15:35 |
Andrey_R
Messages: 441 Registered: January 2012 Location: Israel
|
Senior Member |
|
|
Michel Cadot wrote on Sat, 23 July 2022 18:17
This is a very old discussion about what is in and what is not in both these statistics which change with the versions and even patches.
See the following threads to have a quick look:
Jonathan Lewis' blog: Parse Calls
Christian Antognini's blog: The Broken Statistics: "parse count (total)" and "session cursor cache hits"
Oracle community: about "session cursor cache hits" and "parse count(total)" statistics
Thanks Michel. Will do.
But I would like to just clarify..
Tom Kyte said:
Quote:there are three types of parses (well, maybe four) in Oracle...
there is the dreaded hard parse - they are VERY VERY VERY bad.
there is the hurtful soft parse - they are VERY VERY very bad.
there is the hated softer soft parse you might be able to achieve with session cached cursors - they are VERY very very bad.
then there is the absence of a parse, no parse, silence. This is golden, this is perfect, this is the goal.
So From what I understand:
Hard Parse - when you have nothin for the executed SQL in the cache library and you invest tons of work to produce an exec plan and write it down into the library.
Soft Parse - when you have an SQL executing and you go look for the plan in the library in the Shared Pool and you get it back to your session.
Softer soft Parse - when you have already Soft/Hard Parsed a query in your session so it's in your sessions's cache and you re-use the plan from there very easily
What the hack is No Parse then
Is that some kind of PL/SQL static SQL execution that is somehow even more efficient than the "regular" Softer soft parse via SQL engine ?
How is it different than the regular SQL ? what happens when it "Not parsin" versus the regular SQL ? and Why can't the SQL do the same..
Thanks
Andrey
Edit: I think I found the answer here https://asktom.oracle.com/pls/apex/asktom.search?tag=what-is-an-absence-of-parse and here https://docs.oracle.com/cd/B10500_01/java.920/a96654/stmtcach.htm
I'll follow up in case I have further questions. Many many thanks again.
[Updated on: Sat, 23 July 2022 15:41] Report message to a moderator
|
|
|