to improve the efficiency of SQL query how to write the precedence of where statement conditionshttp://blog.csdn.net/sforiz/article/details/5345359We have to do not only write SQL, but also to write good performance of SQL statements.(1) Select the most efficient table name order (valid only in the rule-based optimizer
tree, execution plan and so on reuse, this is called soft and soft parsing. Compared to soft parsing, soft and soft parsing eliminates the overhead of creating a new session cursor, and of course the rest of the open,parse,bind,execute,fetch still needs to be done.Correlation parameter resolution of cursor in SessionOpen_cursors Used to set the total number of session cursor in a single session that can coexist in open state. View V$open_cursor can be used to
Management of 1.Oracle Tables
Naming conventions for table and column names:
Must start with a letter;
Length cannot exceed 30 characters;
Cannot use Oracle's reserved words;
Use only the following characters: A-Z, A-Z, 0-9, $, # etc.
Data types supported by Oracle:
Character type
Char fixed length maximum of 2000 characterschar (four)----' Little Han ' before the descr
used to obtain DDL state information for any database object. For example, you can query the view's DDL information by replacing the first parameter with a ' view ' and the second by changing the name of the view.SELECT dbms_metadata.get_ddl (' TABLE ', ' table_name ', ' user_name ') from DUAL;
Get current modeThis is another query statement that can get the name of the current pattern.SELECT sys_conte
statement is used to query the names of all tables owned by a user. (2) The buffer of sqlplus caches the last SQL statement. You can use "/" to execute the last SQL statement, or use the edit command to edit the last SQL statement. L command (list) (sqlplus command) can display the last command in buffer. The sqlplus
. Although it is not specified when you create a table, some internal fields added to Oracle for maintenance are, these fields can be used as common files.The most familiar pseudo-column is ROWID, which is equivalent to a pointer pointing to the position of the record on the disk. ORA_ROWSCN is newly added to Oracle 10 Gb. It is regarded as the SCN of the last modified record. The Flashback Version
Continue to look at the second case of the query, including the table connection:
SQL> Create Table T as select * From dba_users;
The table has been created.
SQL> Create Table T1 as select * From dba_source;
The table has been created.
SQL> ALTER TABLE t add constraint pk_t primary key (username );
The tabl
Basic query optimization and subquery Optimization in Oracle databases
1. Reasonably sort query Conditions
Oracle uses the bottom-up sequence to parse WHERE data. From the perspective of performance optimization, we recommend that you write the conditions that can filter out a large number of record rows at the end of
functions.1. Detailed process Example 1.1
We consider the following given SQL:
select sysdate from dual;
Run and query v $ SQL in Oracle 10 Gb. The SQL _ID of this SQL statement is
SQL
: CREATE view v_row_col_notnull as select id, 'c1 'cn, c1 cv FROM t_col_row where c1 is not null union all select id, 'c2 'cn, c2 cv FROM t_col_row where c2 is not null union all select id, 'c3' cn, c3 cv FROM t_col_row where c3 is not null;
8. The following may be the oracle view frequently used by DBAs.
1. example: If hash_value: 3111103299 is known, query the SQL
This article mainly describes the Oracle in the simple query and limited query, the following words not to say, come and see together.
Sql:
1,DML (Data Manipulation language): mainly refers to the database query and update operation, q
Label:
Content from: Oracle®database SQL Language Reference 11g Release 2 (11.2) e41084-03. Empolyees table from the HR scheme, warehouses from the OE scheme.
If your table contains hierarchical data, you can use hierarchical query clauses to select rows of data in a hierarchical order, forming a hierarchical tree in the following form: Here is t
, and provide complete security and integrity control, the Distributed Database Service supports distributed processing with outstanding advantages such as portability, compatibility, and connectivity. It is widely used, as a leading Internet database platform, its Spatial technology can manage geographical information more effectively and store and manage massive Spatial information. Based on Oracle database application experience, this article descr
1. Reasonable sorting of query conditions
Oracle uses a bottom-up sequence to parse where writes, and from an optimized performance perspective, it is recommended that the conditions that filter out a large number of record rows be written at the end of the WHERE clause, and the table
The connection conditions between are placed before other where clauses, that is, the easy to determine the conditions of
complete this task in versions earlier than version 2nd, you usually need to use SQL/XML to generate functions, such as xmlelement, xmlforest, and xmldetail (). In Oracle Database 10GIn version 2nd, XQuery will be more efficient than these functions. Specifically, using the ora: View XQuery function within an XQuery expression, you can query existing Relational
When querying by page in oracle, you may encounter data duplication problems. The following describes how to solve the data duplication problem in oracle paging query, hoping to help you.
In oracle paging query, we use a widely recognized and efficient database paging
Optimization of SQL statements in ORACLE notes, oraclesql statements
SQL statement optimization is summarized as follows:
To optimize SQL statements, follow these six steps:
Rational use of Indexes
Avoid or simplify sorting
Eliminate scanning of large tables
Avoid complex wildcard matching
Adjust the performance
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.