当前位置:网站首页>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 .
边栏推荐
- 并发编程学习笔记 之 工具类CountDownLatch、CyclicBarrier详解
- Study and research the way of programming
- 【网络设计】ConvNeXt:A ConvNet for the 2020s
- 【Attention】Visual Attention Network
- ANR优化:导致 OOM 崩溃及相对应的解决方案
- [competition website] collect machine learning / deep learning competition website (continuously updated)
- 研究生新生培训第三周:ResNet+ResNeXt
- Nailing alarm script
- 【bug】XLRDError: Excel xlsx file; not supported
- Research on the implementation principle of reentrantlock in concurrent programming learning notes
猜你喜欢
【语义分割】SETR_Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
pip安装后仍有解决ImportError: No module named XX
Android studio login registration - source code (connect to MySQL database)
tensorboard使用
[go] use of defer
虚假新闻检测论文阅读(五):A Semi-supervised Learning Method for Fake News Detection in Social Media
电脑视频暂停再继续,声音突然变大
clion+opencv+aruco+cmake配置
yum本地源制作
【DL】关于tensor(张量)的介绍和理解
随机推荐
IDEA中设置自动build-改动代码,不用重启工程,刷新页面即可
【CV】请问卷积核(滤波器)3*3、5*5、7*7、11*11 都是具体什么数?
[image classification] how to use mmclassification to train your classification model
ABSA1: Attentional Encoder Network for Targeted Sentiment Classification
【比赛网站】收集机器学习/深度学习比赛网站(持续更新)
day02作业之进程管理
DataX installation
Centos7 silently installs Oracle
在uni-app项目中,如何实现微信小程序openid的获取
MySql统计函数COUNT详解
【综述】图像分类网络
30 knowledge points that must be mastered in quantitative development [what is level-2 data]
【Transformer】ACMix:On the Integration of Self-Attention and Convolution
Exploration of flutter drawing skills: draw arrows together (skill development)
Thinkphp6 pipeline mode pipeline use
[database] database course design - vaccination database
C # judge whether the user accesses by mobile phone or computer
性能优化之趣谈线程池:线程开的越多就越好吗?
Spring, summer, autumn and winter with Miss Zhang (4)
【Transformer】SOFT: Softmax-free Transformer with Linear Complexity