当前位置:网站首页>What does SQL replace or
What does SQL replace or
2022-06-12 19:50:00 【WD Technology】
(1) use UNION Replace OR ( For index columns )
Usually , use UNION Replace WHERE In Clause OR Will play a better effect . Use for non indexed columns OR Will cause a full table scan . pay attention to , The above rules are only valid for multiple index columns . If there is column
Not indexed , Query efficiency may be because you don't have a choice OR And lower . In the following example , LOC_ID and REGION There's an index on it .
Efficient :
SELECT LOC_ID , LOC_DESC, REGION FROM LOCATION WHERE LOC_ID = 10 UNION SELECT LOC_ID , LOC_DESC ,REGION FROM LOCATION WHERE REGION = “MELBOURNE”
Inefficient :
SELECT LOC_ID , LOC_DESC, REGION FROM LOCATION WHERE LOC_ID = 10 OR REGION = “MELBOURNE”
If you insist on using OR, Then you need to return the index column with the least number of records, which is written at the top .
(2) use IN To replace OR
边栏推荐
- Axure RP 9 for MAC (interactive product prototyping tool) Chinese version
- Reading applet based on wechat e-book graduation design (2) applet function
- 【GAMES101】课堂笔记8–着色(着色频率、图形管线、纹理映射)
- [notes for question brushing] line segment tree
- 基于微信电子书阅读小程序毕业设计毕设作品(7)中期检查报告
- First build green, then build city
- [games101] class note 8 - shading (shading frequency, graphics pipeline, texture mapping)
- Interpreter Files
- Process creation fork (), demise wait()
- Basic structure of arithmetic unit
猜你喜欢

Negative remainder problem

3D object detection

Negative remainder problem

How to make a computer installation and startup USB flash disk

Wechat e-book reading applet graduation design completion works (8) graduation design thesis template

Reading small programs based on wechat e-book graduation design works (7) Interim inspection report

Detailed explanation of IO flow basic knowledge -- file and IO flow principle

Demand and business model innovation-4-strategy

进程的创建fork()、消亡wait()

选电子工程被劝退,真的没前景了?
随机推荐
Demand and business model innovation - demand 2- demand basis
Unsupported class file major version 60
Is it really hopeless to choose electronic engineering and be discouraged?
【GAMES101】课堂笔记8–着色(着色频率、图形管线、纹理映射)
Basic structure of arithmetic unit
META-INF、WEB-INF分别是什么?
[splishsplash] custom exporter
Leetcode topic [string]-344- reverse string
[games101] class note 8 - shading (shading frequency, graphics pipeline, texture mapping)
User and group permissions
In 2022, 20 cities with the largest number of college students in China
[digital ic/fpga] data accumulation output
Mode of most elements (map, sort, random, Boyer Moore voting method)
JDBC接口总结
Blue Bridge Cup basic-14 VIP question time conversion
1. Getting to know R
Original introduction to Jenkins' configuration options
Demand and business model innovation-4-strategy
What is data driven
Reading small programs based on wechat e-book graduation design works (7) Interim inspection report