当前位置:网站首页>The differences and reasons between MySQL with and without quotation marks when querying string types
The differences and reasons between MySQL with and without quotation marks when querying string types
2022-07-29 06:05:00 【Spicy next door 4】
Recently, I have been working on data , Problems encountered .
It is to query the daily trading data of a stock when querying the historical data of the stock , Because I didn't pay attention when running threads python Write sql Without single quotation marks . As shown in the figure below :

And then run the task regularly on the lost server , The next morning, I found that the data didn't come out . And then the tragedy . Just find out why . Generally, the amount of data is small, and we can't see the difference between them . The following is the data volume of this table :

I first print out the code with time , Time sharing printing . The log that comes out is as follows .

It can be seen from the figure that querying data takes a lot of time , And it takes almost no time to calculate . So I put select Copy the statement to navicat Run in , The following is the running time without single quotation marks :

Then I run the stock code with single quotation marks . Here is a screenshot

It can be seen from the two pictures , There is a difference in query speed between the two 10 More than a second . It's built on 900W Measured on the basis of data . Therefore, you must pay attention to single quotation marks when querying string conditions .
Without single quotation marks mysql It will give you type conversion of the data in the database . This will take more time . See the following figure for the official documentation :

On the blackboard :1、 When querying by condition, query by character type , Do not cross character type queries across the Pacific .
2、 For tables with a large amount of data, try to divide them , Index building .
边栏推荐
- [go] use of defer
- 通过简单的脚本在Linux环境实现Mysql数据库的定时备份(Mysqldump命令备份)
- FFmpeg创作GIF表情包教程来了!赶紧说声多谢乌蝇哥?
- ANR优化:导致 OOM 崩溃及相对应的解决方案
- mysql插入百万数据(使用函数和存储过程)
- [database] database course design - vaccination database
- 【目标检测】Generalized Focal Loss V1
- asyncawait和promise的区别
- 【bug】XLRDError: Excel xlsx file; not supported
- 【Transformer】SOFT: Softmax-free Transformer with Linear Complexity
猜你喜欢

ABSA1: Attentional Encoder Network for Targeted Sentiment Classification

How to obtain openid of wechat applet in uni app project

第一周任务 深度学习和pytorch基础

【Transformer】SegFormer:Simple and Efficient Design for Semantic Segmentation with Transformers

Anr Optimization: cause oom crash and corresponding solutions

【语义分割】Mapillary 数据集简介

研究生新生培训第三周:ResNet+ResNeXt

SSM integration
![[overview] image classification network](/img/2b/7e3ba36a4d7e95cb262eebaadee2f3.png)
[overview] image classification network

Reporting Services- Web Service
随机推荐
并发编程学习笔记 之 工具类CountDownLatch、CyclicBarrier详解
Detailed explanation of MySQL statistical function count
Detailed explanation of tool classes countdownlatch and cyclicbarrier of concurrent programming learning notes
并发编程学习笔记 之 工具类Semaphore(信号量)
ROS教程(Xavier)
[DL] introduction and understanding of tensor
Ribbon学习笔记一
These process knowledge you must know
第一周任务 深度学习和pytorch基础
IDEA中设置自动build-改动代码,不用重启工程,刷新页面即可
Isaccessible() method: use reflection techniques to improve your performance several times
SSM integration
The third week of postgraduate freshman training: resnet+resnext
并发编程学习笔记 之 原子操作类AtomicReference、AtomicStampedReference详解
mysql在查询字符串类型的时候带单引号和不带的区别和原因
DCAT batch operation popup and parameter transfer
yum本地源制作
Detailed explanation of atomic operation class atomicinteger in learning notes of concurrent programming
在uni-app项目中,如何实现微信小程序openid的获取
ABSA1: Attentional Encoder Network for Targeted Sentiment Classification