当前位置:网站首页>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
边栏推荐
- The latest Ningxia construction safety officer simulation question bank and answers in 2022
- 编程工具下载地址
- Module 8 fonctionnement
- Original introduction to Jenkins' configuration options
- Basic structure of arithmetic unit
- Typescript decorator is basically used
- 合理地配置线程池
- 【数字IC/FPGA】数据累加输出
- Download and configuration of nuitka packaging tutorial
- 存储体系概述
猜你喜欢
基于微信电子书阅读小程序毕业设计毕设作品(2)小程序功能
存储体系概述
Negative remainder problem
[observation] Huawei's next generation data center "adds momentum" to Guangxi's low-carbon and high-quality development
负数取余问题
1. Getting to know R
Reading small program graduation design based on wechat e-book (5) assignment
基于微信电子书阅读小程序毕业设计毕设作品(5)任务书
选电子工程被劝退,真的没前景了?
华尔街备忘单(Wall Street Cheat Sheet)
随机推荐
Storage system overview
[splishsplash] custom exporter
什么是数据驱动
MySQL index classification
7 R read / write data
Module 8 operation
Shell arrays and functions
MySQL log
The joint empowerment plan of Baidu PaddlePaddle large enterprise open innovation center was launched! Help Pudong to upgrade its industry intelligently
BannerViewPager
编程工具下载地址
Axure RP 9 for MAC (interactive product prototyping tool) Chinese version
First build green, then build city
Shell programming regular expressions and metacharacters
进程的创建fork()、消亡wait()
Reading small programs based on wechat e-book graduation design works (7) Interim inspection report
[games101] class note 8 - shading (shading frequency, graphics pipeline, texture mapping)
Business opportunities with an annual increase of 3billion - non cage eggs or a new blue ocean for export to ASEAN
Demand and business model innovation-4-strategy
[generation confrontation network learning III] reading notes of Bigan paper and its principle understanding