consider the tables with indexes and tables with multiple rows. The selection of the internal and external tables can be determined by the formula: Number of matched rows in the outer table * Number of times each query is performed in the inner table, the minimum product is the best solution.2. view the method for executing the solution-use set showplanon to open the showplan option, and you will be able to see the connection sequence and index information. For more details, you must use the SA
int, char and varchar, binary, andvarbinary is not compatible. Incompatible data types may cause the optimizer to fail to perform some of theThe optimization operation of the row. For example:SELECT name from employee WHERE Salary > 60000In this statement, if the salary field is money type, it is difficult for the optimizer to optimize it because 60000is a number of integers. Instead of waiting for run-time conversion, we should convert an integral type into a coin type when programming.
3, tr
based on the connection conditions and find the best solution with the minimum system overhead. The join conditions must fully consider the tables with indexes and tables with multiple rows. The selection of the internal and external tables can be determined by the formula: Number of matched rows in the outer table * Number of times each query is performed in the inner table, the minimum product is the best solution.
2. view the method for executing the solution-use set showplanon to open the s
on the fields in the WHERE clause, which will cause the engine to discard the full table scan using the index. Such as: SELECT * from T1 WHERE f1/2=100 should read: SELECT * from T1 WHERE f1=100*2 SELECT * from RECORD WHERE SUBSTRING (card_no,1,4) = ' 5378 ' should read: SELECT * from RECORD WHERE card_no like ' 5,378% ' SELECT Member_number, first_name, last_name from members WHERE DATEDIFF (Yy,datofbirth,getdate ()) > 21 should read: SELECT Member_
exception. This error occurs because the Smon clears the temporary segment during the database open, and the database is turned on by setting event skipping, but during the recovery process, you encounter a
The code is as follows
Copy Code
Mon June 16 17:53:10 2014Errors in file d:/orant/rdbms73/trace/orcldbwr.trc:Ora-00600:internal error code, arguments: [3600], [3], [14], [], [], [], [], []Mon June 16 18:05:12 2014Errors in file d:/orant/rdbms73/trace/ora06880. TR
account the table with the index, the table with many rows, and the selection of the inner and outer table can be determined by the formula: the number of matches in the outer table * The count of each lookup in the inner-layer table, and the product minimum is the best scheme.Any operation result of a column in a 5.where clause is computed by column in the SQL runtime, so it has to do a table search instead of using the index above the column, and if the results are available at query compile
rows in the outer table * the number of times each lookup in the inner-level table, the product is minimized as the best schemeAny action on a column in a 5.where clause results in a column-wise calculation at the SQL runtime, so it has to perform a table search without using the index above the column, and if the results are available at query compile time, it can be optimized by the SQL optimizer, using the index, and avoiding table searches ( Example: SELECT * from record where substring (ca
second query can use an index to speed up operations.
Do not perform functions, arithmetic operations, or other expression operations on the left-hand side of the "=" in the WHERE clause
Any action on a column causes a table scan, which includes database functions, calculation expressions, and so on, to move the operation to the right of the equals sign whenever possible. SELECT * from T1 WHERE f1/2=100 should read: SELECT * from T1 WHERE f1=100*2 SELECT * from RECORD WHERE SUB
* from T1 WHERE f1/2=100should read:SELECT * from T1 WHERE f1=100*2SELECT * from RECORD WHERE SUBSTRING (card_no,1,4) = ' 5378 'should read:SELECT * from RECORD WHERE card_no like ' 5,378% 'SELECT Member_number, first_name, last_name from membersWHERE DATEDIFF (Yy,datofbirth,getdate ()) > 21should read:SELECT Member_number, first_name, last_name from membersWHERE dateOfBirth That is, any action on a column causes a table scan, which includes database
compile time. However, if an access plan is established at compile time, the value of the variable is still unknown and therefore cannot be selected as an input for the index. The following statement will perform a full table scan: Select ID from t where [email protected] can be changed to force query using index: SELECT ID from T with (index name) where [Email protected]7. You should try to avoid expression operations on the fields in the WHERE clause, which will cause the engine to discard t
to use the index instead:Select ID from T with (index name) where [email protected]7. You should try to avoid expression operations on the field in the Where clause, which will cause the engine to discard the use of the indexFull table scan. Such as:SELECT * from T1 WHERE f1/2=100should read:SELECT * from T1 WHERE f1=100*2SELECT * from RECORD WHERE SUBSTRING (card_no,1,4) = ' 5378 'should read:SELECT * from RECORD WHERE card_no like ' 5,378% 'SELECT
the index. Such as:SELECT * from T1 WHERE f1/2=100should read:SELECT * from T1 WHERE f1=100*2 SELECT * from RECORD WHERE SUBSTRING (card_no,1,4) = ' 5378 'should read:SELECT * from RECORD WHERE card_no like ' 5,378% ' SELECT Member_number, first_name, last_name from membersWHERE DATEDIFF (Yy,datofbirth,getdate ()) > 21should read:SELECT Member_number, first_name, last_name from membersWHERE dateOfBirth That is, any action on a column causes a table s
protected]
7. You should try to avoid expression operations on the fields in the WHERE clause, which will cause the engine to discard the full table scan using the index. Such as:
Select * from T1 Where f1/2=100
should read:
Select * from T1 Where f1=100*2
Select * from RECORD Where SUBSTRING (card_no,1,4) = ' 5378 '
should read:
Select * from RECORD Where card_no like ' 5,378% '
Select Membe
. The leading column must be the most frequently used column.
4. Before a multi-table operation is executed, the query optimizer will list several possible connection solutions based on the connection conditions and find the best solution with the minimum system overhead. The join conditions must fully consider the tables with indexes and tables with multiple rows. The selection of the internal and external tables can be determined by the formula: Number of matched rows in the outer table * Numb
considerationsTables with Multiple indexes and rows; tables with internal and external IndexesSelectFormula: ExternalLayerNumber of matched rows in the table*InternalLayerTableEachOnceQueryThe number of times of searching is determined, multiplicationProductMinimumIsThe best solution.2.QueryViewExecutiveSolution--UseSet showplanOn, HittingOpenShowplanOption, You can seeConnectionConnectShunSequence and usageTypeIndex information; want to see moreDetailsInformation, requiredSaRoleExecutiveLineDb
. Therefore, it has to perform table search without using the index on the column; if these results are obtained during query compilation, they can be optimized by the SQL optimizer and indexed to avoid table search.
Example:
Select * from record where substring (card_no, 5378) = '20140901' Select * from record where card_no like '201312'
Any operation on the column will cause the table to scan, including database functions and calculation expression
overhead. The join conditions must fully consider the tables with indexes and tables with multiple rows. The selection of the internal and external tables can be determined by the formula: Number of matched rows in the outer table * Number of times each query is performed in the inner table, the minimum product is the best solution.
2. view the method for executing the solution-use set showplanon to open the showplan option, and you will be able to see the connection sequence and index informat
only a full set of connection conditions can be executed for the best solution.
---- Conclusion:
---- 1. Before a multi-table operation is executed, the query optimizer will list several possible connection schemes based on the connection conditions and find the optimal system overhead.Solution. The join conditions should fully consider the tables with indexes and tables with multiple rows. The selection of the internal and external tables can be calculated by the formula: matching rows in the
= @ numYou can change it to force query to use the index:Select id from t with (index name) where num = @ num7. Avoid performing expression operations on fields in the where clause as much as possible, which will cause the engine to discard the use of indexes for full table scanning. For example:SELECT * FROM T1 WHERE F1/2 = 100Should be changed:SELECT * FROM T1 WHERE F1 = 100*2SELECT * from record where substring (CARD_NO, 5378) = '20140901'Should b
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.