Read about how to optimize sql query using execution plan, The latest news, videos, and discussion topics about how to optimize sql query using execution plan from alibabacloud.com
* from T_userinfo where userid= ' Abcde12ef '
Note: If the lookup condition behind the where has a clustered index column. That is, when and only if the condition behind the where contains a clustered index. 4. Index Scan:The overall scan of nonclustered indexes. To create a nonclustered index: CREATE nonclustered INDEX ix_name on T_userinfo (UserName)
Select UserName from T_userinfo---as long as not all columns *
Note: When you do not overwrite and include all of the required columns in
Explain select * from film where rating>9\g;
Select_type
Represents the type of select
Simple
Represents a simple table without table joins or subqueries
Primry
Main query (outer query)
UNION
The second or subsequent query sta
MySQL5.6 how to optimize slow query SQL statements -- Introduction to slow logs
Recently, a development team complained that the mysql cluster included in our platform was not good and always reported the "heartbeat Error" of mysql and analyzed the logs they collected, no network problems were found between mysql cluster nodes, but a very interesting phenomenon w
Label:If encountering a binding snooping causes a slow execution schedule, want to clear a SQL execution plan, let it hard parse, for a long time did not find a direct operation share pool method (unless alter system flush Shared_pool), SQL can only be hardened by parsing th
Let's take a look at what bookmarks are:When the non-clustered index selected by the optimizer only contains a part of the query request fields, a lookup is required to retrieve other fields to meet the request. For a table with clustered indexes, it is a key lookup, and for a heap table it is an RID lookup ). This kind of search is-bookmarks search.Bookmarksearch reads data from the table based on the index row locator. Therefore, in addition to the
Let's take a look at what bookmarks are:
When the non-clustered index selected by the optimizer only contains a part of the query request fields, a lookup is required to retrieve other fields to meet the request. For a table with clustered indexes, it is a key lookup, and for a heap table it is an RID lookup ). This kind of search is-bookmarks search.
Bookmarksearch reads data from the table based on the index row locator. Therefore, in addition to t
Before executing an SQL statement, Oracle needs to first check the SQL Execution Plan and then execute the SQL statement according to the execution plan. The optimizer is responsible fo
months. Read the online Help documentation for SQL Server, which describes the restrictions on the size of the job history log-> The job system, the right-click Property,->sql Server Agent, and the maximum size of the job history log (rows) Default is 1000 if a machine has a large number of jobs, be sure to increase it, for example, 100000 the maximum number of rows per job history log defaults to 100 if
at the SQL Run schedule:
ID
Select_type
Table
type
Possible_keys
Key
Key_len
ref
rows
Extra
1
Simple
T
Range
PRIMARY
PRIMARY
24
299392
Using index condition; Using Filesort
1
Simple
R
Eq_ref
PRIMARY
you find slow statements and provide optimization solutions. In MySQL, you need to enable slow log records for analysis (records can be saved in tables or files. by default, they are saved in files, and our system uses the default method ).
First, let's take a look at what the records in the MySQL slow query log look like:
Time Id Command Argument# Time: 141010 9:33:57# User@Host: root[root] @ localhost [] Id: 1# Query_time:
:
It can be seen that there is a clustered index PK_UserID and a non-clustered index IX_UserName.
Look at the effect of creating a bookmarked search:
Select UserName, Gender from dbo. UserInfo where UserName = 'usern600'
According to the preceding SQL Execution Plan, a Key Lookup is generated, as shown in figure
If you rewrite the preceding
Tag:oraclesql optimization Execution Plan gg HP UNIX monitors a process that consumes high CPU and later finds that there is a problem with the statement execution plan in GG, which causes the CPU to be high. Since the statements in GG cannot be changed, how can you change the ex
Explain + SQL statementThe type types returned areAll full table scan (special with limit), type for this type, indicates that the table can be optimizedIndex full Index ScanRange Lookup for indexed columnsIndex_merge merge indexes, using multiple single-column indexesRef finds one or more values based on an indexEq_ref using primary KEY or unique type when conne
Use the example to explain how to optimize the database query by using the prefetch_related () function in the Django framework in Python, pythondjango
Instance background
Assume that the Personal Information System must record the home, residence, and city of each individual in the system. The database design is as follows:
The content of Models. py is as follo
(BUSINESSSTATUS1,BUSINESSSTATUS2)The following query is to query the so-called special dataSELECT * from businesstable where businessstatus1=3 and businessstatus2=10Find the execution plan as follows: The whole table scan, the IO cost is not small,In this case, obviously there is only one data, but to go full-table sc
executions (estimated executions and executions) The operator estimates the number of executions and the actual number of executions. 6. Estimated operation cost (estimated operator overhead) The overhead of performing a specific operation. 7. Estimated subtree cost (estimated subtree size) It represents the cumulative total cost of the entire subtree until the current node. 8. Estimated number of rows (estimated rows) The number of rows that the operator expects to return. In some case
Today, I am reading the new features of SQL Server 2012. when I see one, I find sys. the dm_exec_query_stats System View is upgraded. Because this attempt is always in use and is quite useful, it can be said that it is the calculator used to find and optimize SQL statements. Therefore, we have made a special record today.
The definition of SYS. dm_exec_query
We always hope to avoid full table scanning by the database engine when doing some queries, because the full table scan takes a long time, and most of the scans do not make sense to the client. Which of the following methods can be used in MySQL to avoid full table scan? In addition to the optimization of queries by using index columns or partitions, which of the following methods do we know? I read a program written by a foreigner a few days ago and
The other day I read a foreigner's Program I am very interested in using many limit keywords in MySQL queries, the limit keyword seems to be used by more MySQL database programmers for querying pages (of course, this is also a good query optimization). Here is an example, suppose we need a paging query. Oracle generally uses the following
18/1/16
In the SPRINGMVC (13): Using SPRINGMVC to optimize the order management System example (login and logout of the simple implementation), to the "Supermarket order management system" to add a new function: User management function (jump all user queries and conditional user query);
Learning stage, so the use of the framework: SPRINGMVC + spring + JDBC, adde
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.