Get the App
SLTechnology News&Howtos  ›  Database  › 

[architecture] shared understanding of SQL

Shulou Source: shulou.com Published: 2022-06-01 04:49:43 10月02日 Update

1. Shared SQL function

After SQL is shared, hard parsing can be reduced, which consumes a lot of resources.

two。 Shared SQL concept

Sharing SQL is to make SQL exactly the same. In this way, there will be less hard parsing and more hard parsing during the execution plan of SQL parsing.

The word "complete" here means that the SQL statement must be exactly the same, almost not at all! Multiple spaces, carriage returns, case, etc., all require the same.

3. In order to share SQL, we need

(1) unify the writing style

(2) use bound variables (placeholders)

4. Find SQL statements that are not shared

Query sql statements with less execution times in v$sql. Observe whether these sql statements are executed frequently.

SQL > select SQL_FULLTEXT from v$sql where EXECUTIONS=1 order by sql_text

5. Analytical hit rate

The hit rate reflects the efficiency of soft analytic hit. The hit rate is usually more than 99%. If the hit rate is 98%, it means the hit rate is relatively poor.

SQL > select sum (pinhits) / sum (pins) * 100 from v$librarycache

SQL > select sum (gets), sum (getmisses), 100*sum (gets-getmisses) / sum (gets) from v$rowcache where gets > 0

-end-

Tags: Hit rate statement no same identical function variable multiple size efficiency more concept number of times spaces if resource style response query consumption Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MariaDB OPPO Reno MySQL Shulou Technology