Home > Database > Mysql Tutorial > SQLSERVER对索引的利用

SQLSERVER对索引的利用

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:45:17
Original
1061 people have browsed it

SQLSERVER对索引的利用 写SQL语句的时候很多时候会用到filter筛选掉一些记录,SQL对筛选条件简称:SARG(search argument/SARG) 1 where amount 4000 and amount 6000 上面这句就是筛选条件 当然这里不是说SQLSERVER的where子句,是说SQLSERVER对索引的利用

SQLSERVER对索引的利用

写SQL语句的时候很多时候会用到filter筛选掉一些记录,SQL对筛选条件简称:SARG(search argument/SARG)

<span>1</span> <span>where</span>  amount<span>></span><span>4000</span> <span>and</span> amount<span><span>6000</span></span>
Copy after login

上面这句就是筛选条件

当然这里不是说SQLSERVER的where子句,是说SQLSERVER对索引的利用

在SQLSERVER对于没有SARG运算符的表达式,索引是没有用的,SQLSERVER对它们很难使用比较优化的做法。

意思是说,如果你的SQL语句中没有where子句包括非SARG运算符,那么你的SQL语句是不会用到表格中的索引的

 

下面说一下哪些是非SARG运算符

非SARG运算符包括

NOT、

NOT EXISTS、

NOT IN、

NOT LIKE

规律就是有“NOT” 关键字 或者 不等于的意思 基本上利用不了索引

还有一些内部函数,如果使用这些内部函数SQLSERVER也不会用到索引

内部函数,例如:CONVERT(),UPPER()等

 

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Problem with tp6 connecting to sqlserver database
From 1970-01-01 08:00:00
0
0
0
Unable to connect to SQL Server in Laravel
From 1970-01-01 08:00:00
0
0
0
Methods of parsing MYD, MYI, and FRM files
From 1970-01-01 08:00:00
0
0
0
SQLSTATE: User login failed
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template