Impact of oracle database performance on SQL parse

Source: Internet
Author: User
Tags locale setting

1. Types of SQL parse

SQL parse is usually divided into hard parsing and soft parsing. When SQL is executed for the first time, hard parsing will occur, and subsequent execution will be soft parsing if it can be found in the shared pool. Therefore, to improve data performance, try to find the SQL statement executed each time in the shared pool.

 

2. Under what circumstances does SQL send hard parsing?

 1) Changes in Statistics

Zookeeper

2) ddl operations are performed on tables in SQL, including grant and revoke.

3) Execution Plan kicked out of shared pool

4) trace is enabled.

5) Variable Length Variation

6) enable outline and 11G enable SPM

7) the SQL statements are the same but the referenced tables are different. For example, they are not the same owner.

8) the environment changes, such as Sort area size, Hash area size, and locale setting.

 

3. Soft resolution Conditions

When you submit an SQL statement to ORACLE, ORACLE first checks whether the same statement exists in the shared memory. It should be noted that ORACLE adopts a strict match between the two. To achieve sharing, the SQL statements must be identical (including spaces and line breaks ). If they are the same, soft resolution will be available.

4,How can we determine whether two SQL statements are the same SQL statement?

1) case and space and letter values are inconsistent:

SELECT * FROM emp WHERE empno = 1000;

Different from each of the following

SELECT * from emp WHERE empno = 1000;

SELECT * FROM emp WHERE empno = 1000;

SELECT * FROM emp WHERE empno = 2000;

In the preceding statements, the column values are in direct SQL statements. We call these SQL statements hard-coded or literal-value SQL statements.

 

2) The name of the bound variable is different.

Bind variables)

For example:

A. The two SQL statements are considered the same

Select * from emp where empno =: empno;

Select * from emp where empno =: empno;

B. The two SQL statements are considered different.

Select * from emp where empno =: empno1;

Select * from emp where empno =: empno2;

The preceding statements are called variable binding SQL statements.

 

3) The object name is the same, but the owner is different.

Compare the objects involved in the issued statement with The objects involved in the existing statement.

For example:

If both user user1 and user user2 have an EMP table

Statement issued by user1: SELECT * from emp;

Statement issued by user user2: SELECT * from emp; is considered to be different statements,

Because the EMP referenced in the two statements does not refer to the same table.

4) The bundled variables used in SQL statements must be of the same bundle type.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.