SQL优化建议备忘录_MySQL
bitsCN.com
SQL优化建议备忘录
1、SQL注释一般不会增加性能开销,并且可以增强可读性
2、事务宜简短
3、避免游标操作
因为游标占用大量的资源
4、IN和EXISTS的权衡
5、避免嵌套视图和在单表检索时避免指向多个表的视图
6、DISTINCT和ORDER BY开销
完全可以在应用程序中进行处理
7、尽量为每一列设置默认值,并且NOT NULL。因为包含NULL值的列不能利用索引,即使你创建了索引。使用了IS NULL和IS NOT NULL的查询也不会使用索引
8、海量查询避免类型转换
9、为外键关联的列建立索引
10、UNION与UNION ALL,后者效率更高
11、INSERT语句
INSERT INTO table VALUES (…)性能差于INSERT INTO table (…) VALUES (…)
12、使用ORDER BY时的注意事项
任何在ORDER BY中的非索引项或者计算表达式都将降低查询效率
13、BETWEEN与IN的权衡
…
bitsCN.com
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

iPhone 14 Pro comes with many new unique features, such as a new 48MP sensor, Always-On Display, and a new Dynamic Island. Dynamic Island is Apple's attempt to blur the line between hardware and software by covering the front display cutout with a software overlay. This overlay interacts with your iPhone and displays ongoing activity in real time. If you recently received a new device and want to make the most of the new Dynamic Island, you can use it on iPhone 14 Pro and Pro Max. When will Dynamic Island be activated? Whenever you have activity in the background that you want to track in real time, Dynamic Isla

Link AppleNotes on iPhone using the Add Link feature. Notes: You can only create links between Apple Notes on iPhone if you have iOS17 installed. Open the Notes app on your iPhone. Now, open the note where you want to add the link. You can also choose to create a new note. Click anywhere on the screen. This will show you a menu. Click the arrow on the right to see the "Add link" option. click it. Now you can type the name of the note or the web page URL. Then, click Done in the upper right corner and the added link will appear in the note. If you want to add a link to a word, just double-click the word to select it, select "Add Link" and press

For friends who are accustomed to using iPhone memos to record things, this new improvement in iOS17 should not be missed: in memos, you can add links to jump to other memos. The operation method is as follows: 1. Tap in the memo input area and select "Add Link". 2. Enter the memo title keyword to search, and then select the memo you want to jump to to complete the addition. 3. Tap the link to jump.

In iOS 17 and MacOS Sonoma, Apple added the ability to open and annotate PDFs directly in the Notes app. Read on to find out how it's done. In the latest versions of iOS and macOS, Apple has updated the Notes app to support inline PDFs, which means you can insert PDFs into Notes and then read, annotate, and collaborate on the document. This feature also works with scanned documents and is available on both iPhone and iPad. Annotate a PDF in Notes on iPhone and iPad If you're using an iPhone and want to annotate a PDF in Notes, the first thing to do is select the PDF file

There will be a lot of resources in the 115 network disk, so how to find resources? Users can search for the resources they need in the software, then enter the download interface, and then choose to save to the network disk. This introduction to the method of finding resources on 115 network disk can tell you the specific content. The following is a detailed introduction, come and take a look. How to find resources on 115 network disk? Answer: Search the content in the software, and then click to save to the network disk. Detailed introduction: 1. First enter the resources you want in the app. 2. Then click the keyword link that appears. 3. Then enter the download interface. 4. Click Save to network disk inside.

How to Disable Location-Based Naming of Recordings on iPhone There is more than one way to stop Voice Memos from naming recordings based on your location. Go to Settings from your iPhone's home screen. In the settings menu, scroll down and tap "Voice Memos" to proceed further. Here, you can use the toggle to disable Location-Based Naming for Voice Memos. In the same menu, you can also set an app's location access to "Never," which pretty much does the same thing. That’s all. Recordings will no longer be named after your location. The next audio clip you record using the Voice Memos app will be named "New Recording" instead of your street or apartment name. They will also be named sequentially, e.g. New Recording 2, New Recording

Han Xiaoquan is a software that can watch many Korean dramas, so why is there suddenly no resource? This software may have no resources due to network problems, version problems, or copyright issues. This article about the reason why Han Xiaoquan suddenly has no resources can tell you the specific content. The following is a detailed introduction, come and take a look. Why did Han Xiaoquan suddenly have no resources? Answer: Due to network problems, version problems, and copyright issues, detailed introduction: 1. Solution to network problems: You can choose a different network, and then log in to the software again to try. 2. Solution to version problems: Users can download the latest version of this software from the official website. 3. Solutions to copyright issues: Some Korean dramas are removed from the shelves due to copyright issues. You can choose other Korean dramas to watch.

Explorer.exe crashes in Safe Mode on Windows 11? Not anymore. Microsoft has just released a new patch to the Dev Channel, and while there are no new features in this release, many fixes and improvements are making their way into the Windows Insider program, including an annoying bug where Explorer.exe crashes in Safe Mode. Well, you can say goodbye to it now, at least in the Windows Insider Program. But as with all these updates, they will also be coming to live Windows servers. Fixed an issue that caused Explorer.exe to not work in safe mode. However, there are a few other fixes coming to File Explorer, so Microsoft is keen to get it working
