Let's look at what bookmarks look for:
When the optimizer chooses a nonclustered index that contains only part of the query request, a lookup (lookup) is required to retrieve other fields to satisfy the request. A key lookup for a table with a clustered index (key lookup) is a RID lookup (RID lookup) for a heap table. This lookup is--bookmark lookup.
The bookmark lookup reads the data from the table based on the row locator of the index. Therefore,
50 tips for optimizing query: (see which one is suitable for you)
1. Place data, logs, and indexes on different I/O devices to increase the reading speed. In the past, tempdb can be placed on raid0, which is not supported by SQL2000. The larger the data size (size), the more important it is to increase I/O.
2. vertically and horizontally split the table to reduce the table size (sp_spaceuse)
3. upgrade hard
Tags: MySQL index performanceTitleCREATE TABLE ' score ' (
' id ' int (one-by-one) not null,
' studentid ' int (one) not null,
' subjectid ' int (one) NOT NULL ,
' score ' int (one) not NULL,
PRIMARY KEY (' id ')
) Engine=innodb DEFAULT Charset=utf8;
--Create a new index to improve query performance of three SQL at the same time
ALTER TABLE ' score ' ADD Inde
TRIGGERCREATETYPECREATEOPERATORCREATEIndextypeTenrows selected. CHF@XFF>SELECTtable_name fromuser_tab_privs; no rows selectedCreate a CHF user, authorize Create Session,resource, no V$session,v$sesstat and v$statname view access, log in with Plsql Dev and query the User_tables table (no prompt at logon , only the user will be prompted when the query is executed or the related class is performed)Second, sol
:
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 SQL statement
Select UserName from dbo. UserInfo where User
The database was restarted on Sunday, just looking at the optimized results. By the way, look for new SQL statements to be optimized.Just found several similar statements, as shown belowSelect * From tablea where id not in (select ID from tableb)From execution time 20 seconds ~ 70 seconds.Start AnalysisFirst, whether to use the index. Because both IDs are primary keys, there is no index problem.Next, we analyze the index and find that although these t
By observing the execution plan, we found that the previous execution plan used a hash join for many of the large table connections, and that the query optimizer chose to use parallel execution, faster because of the large number of data involved in the table. And we optimized the execution plan because of the existence of the index, and the data in the table is very large, the filter condition value in a very wide statistical information step range,
1. The query conditions are accurate.II. SQL logic execution sequence The code is as follows:Copy code FROM --> JOIN --> WHERE --> GROUP --> HAVING --> DISTINCT --> ORDER --> TOP III. HorizontalQuery required fieldsWhen connecting multiple tables in an SQL statement, use the table alias and prefix the alias on each Column, this reduces the parsing time and s
A Data Analysis System was developed some time ago, using Asp.net + sqlserver 2000. Because the data volume is collected in real time, two or three pieces of data are inserted per second on average. The customer uses the system to analyze the data during working days.
During table creation, the latest data is stored in the History Table due to the large amount of data. Some manually processed data or automatically processed data based on conditions (the automatically processed data accounts f
Tags: style using SP on C log r ad Size1. Split the multi-table connection into smaller parts in order to execute2. Replace the outer connection with an inner connection.3. Priority line which can greatly reduce the operation of the return row, and then the production of the temporary table and other tables to the left connection.4. Modify the like program to remove% because there is no index to use.5. Use stored procedures to encapsulate which complex SQL
Label:Use the top command to isolate the highest CPU spid in a Linux system, And then press the following Select SID, serial#, Username Osuser, Machine Program Process To_char (Logon_time, ' yyyy/mm/dd hh24:mi:ss ') logon From V$session where Paddr in (select addr from v$process where spid in (' 24566 ')); Select S.sid, s.serial#, S.username, S.osuser, S.machine, S.program, S.process, To_char (S.logon_time, ' yyyy/mm/dd hh24:mi:ss ') logon, P.spid From V$session s,v$process p where 1=1 and S.
"SQL performance optimization is a black magicJust like alchemy:Various formulations are difficult to understand and obscure,Only a small number of people in the circle can understand. ”
This is a misconception that SQL database uses a known algorithm to implement performance that can be expected. The problem, how
([Idx_noncls_include_
Exceptorderid])' shenzhen '
GO As you know, nonclustered index columns do not need to contain columns that create a clustered index, so what exactly is the fact? Conclusion: In fact, there is no need for any nonclustered index column to contain the column that created the clustered index, because the column that creates the clustered index is part of the nonclustered Index collection column, which means that the nonclustered index collection column contains the clustered
Label:About the effect of SQL condition matching on execution efficiency test First, create a scalar functionCreate function Ff_test ()returns intAsBeginDECLARE @i int=0while (@iSet @i+=1Return @iEnd Next, select a random table, where you use the business table Mt_delegate Observe the following two types of situations 1. Select * from mt_delegate where procid=-1 or dbo.ff_test () >10000 2. Select * from Mt_delegate where dbo.ff_test () >10000 or Proci
column on the Computecolumn table and create a nonclustered indexALTER TABLE dbo. Computecolumn Addfullname as (FirstName+"+LastName) gocreate nonclustered INDEX ix_ Compcol_citytrimon dbo. Computecolumn (FullName) GOCreate a computed column on a computecolumncompare tableALTER TABLE dbo.computecolumncompare addfullname_p as (FirstName+"+LastName) GOLast query two tables look at the results of the query pl
For a period of time performance test, put oneself in the performance test process, use the Oracle used in the SQL statement to organize, do a memo;(1) Multiple fields are spliced in some format"||" string concatenation characters;Example: concatenation of "id" and "code" with commas: select T.id| | ', ' | | T.code from otable t;Note: MySQL uses the concat () fun
Tags: style blog http ar color OS using SP dataOriginal: SQL Server access Oracle Query performance Problem Resolution1. Questions The system has a module that needs to query the data in the Oracle database. It is now implemented by establishing a linked server. SQL Server
(BUSINESSSTATUS1,BUSINESSSTATUS2)where BusinessStatus1= 3 and BusinessStatus2=ten-- after the statistics are created, be aware of the update UPDATESTATISTICS with FullscanAfter the statistics are created, a statistic that you just created is added to the table.Now look at the execution plan for this query, and find that it goes through the index as expectedWhile observing the IO situation, there is also a significant dropSummarize:The above by manu
to explicitly delete all temporary tables at the end of the stored procedure, TRUNCATE table first, and then drop table, which avoids longer locking of the system tables. 25. Avoid using cursors as much as possible, because cursors are inefficient and should be considered for overwriting if the cursor is manipulating more than 10,000 rows of data. 26. Before using a cursor-based method or temporal table method, you should first look for a set-based solution to solve the problem, and the set-bas
Label:1) SQL query elapsed Time statementPrinciple: Record the current time 1, execute the SQL statement, record the current time 2, show the difference between Time 2 and time 1.Since the time elapsed for the first execution is real time, then it is saved in the cache, so the query after the second time will be signif
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.