暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
52个SQL性能优化策略.pdf
777
5页
51次
2024-08-15
5墨值下载
52 SQL
1
52 SQL
Created
Last Edited Time
Type DATABASE
Property
Status
Created By
Last Edited By
File
1. Where order by
2. Where NULL NULL NOT NULL
0 -1
3. Where != <> MySQL < <= = > >= BETWEEN IN
LIKE
4. Where or UNION
select id from t where num=10 union all select id from t where num=20
5. in not in between in select id from t where num
between 1 and 3
6. select id from t where name like ‘%abc%’ select id from t where name like ‘%abc’
select id from t where name like ‘abc%’
7. Where
8. Where Where
9. exists in select num from a where num in(select num from b). select num
from a where exists(select 1 from b where num=a.num)
10. select insert update insert update
6
11. clustered clustered
clustered
clustered
12.
13. varchar/nvarchar char/nchar
14. ”“ select from t “*”
15.
16. (Alias) SQL , Column . ,
Column
17. SQL
TempDB
@January 25, 2022 8:46 AM
52 SQL
2
18. SQL nolock nolock
nolock 3 nolock
nolock Oracle undo
nolock
19. 5 JOIN
, 2
20. select SQL7.0
21. OR UNION ,
UNION all . OR UNION
22. IN
23.
SQL SQL,
TempDB
24. = +5 < SQL
SERVER , = +5
25.
select a.personMemberID, * from chineseresume a,personmember b where personMemberID = b.referenceid and a.personMemberID = ‘JCNPRH39681
select a.personMemberID, * from chineseresume a,personmember b where a.personMemberID = b.referenceid and a.personMemberID = ‘JCNPRH396
select a.personMemberID, * from chineseresume a,personmember b where b.referenceid = ‘JCNPRH39681’ and a.personMemberID = ‘JCNPRH39681’
26. exists select count(1) count count(1) count(*)
27. “>=” “>”
28. OLTP 6
index index_name table scan
29. SQL
SELECT * FROM record WHERE substrINg(card_no,1,4)=’5378’ (13 )
SELECT * FROM record WHERE amount/30< 1000 11
SELECT * FROM record WHERE convert(char(10),date,112)=’19991201’ 10
WHERE SQL
SQL SQL
SELECT * FROM record WHERE card_no like ‘5378%’ < 1
SELECT * FROM record WHERE amount< 1000*30 < 1
SELECT * FROM record WHERE date= ‘1999/12/01’ < 1
30. !
31. SQL !
( connect by )
32. ( )
52 SQL
3
Oracle FROM FROM ( driving table)
FROM , 3 ,
(intersection table) ,
33. GROUP BY , GROUP BY .
:
SELECT JOB , AVG(SAL)
FROM EMP
GROUP BY JOB
HAVING JOB =’PRESIDENT’
OR JOB =’MANAGER’
:
SELECT JOB , AVG(SAL)
FROM EMP
WHERE JOB =’PRESIDENT’
OR JOB =’MANAGER’
GROUP BY JOB
34. SQL Oracle sql
35. 1.5
36. ;
;
37. ; (99%)
TempDB
38. ;
; (Insert Update Delete) ;
39.
300
Where
AND Where
Where
3
of 5
5墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。