当前位置:网站首页>MySQL optimization, the SQL execution is very stuck, and the SQL structure will not be changed until it ends in 10 seconds
MySQL optimization, the SQL execution is very stuck, and the SQL structure will not be changed until it ends in 10 seconds
2022-06-23 03:48:00 【CSDN Q & A】
One sql The execution is very catchy , Don't change sql structure ,9 More than ten thousand +8 More than ten thousand data , achieve 10 End query in seconds
primary sql SELECT * FROM a_itemsListVer WHERE (locate(' Waterproof material , Waterproofing membrane ', waterproof) > 0 OR itemsListId IN (SELECT itemsListId FROM a_itemsListOtherVer WHERE locate(' Waterproofing membrane ', waterproofMemo) > 0 ))
// The example only retains some key fields .
// Table 1 9 More than 10000 pieces of data
CREATE TABLE a_itemsListVer (id varchar(20) NOT NULL,
itemsListId varchar(20) NOT NULL COMMENT ' Main item id',waterproof varchar(150) NOT NULL DEFAULT '',
PRIMARY KEY (id),
KEY fId (itemsListId),
KEY waterproof (waterproof) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ;
// Sample data INSERT INTO a_itemsListVer VALUES ('zgypu9zqg5ys', 'vs6h24c5b79w', ' Waterproofing membrane ');
// Table two 8 More than 10000 pieces of data
CREATE TABLE a_itemsListOtherVer (id varchar(20) NOT NULL COMMENT 'itemsListVerId identical ',itemsListId varchar(20) NOT NULL COMMENT ' Main item id',waterproofMemo varchar(200) NOT NULL DEFAULT '',
updateTime datetime NOT NULL COMMENT ' Update time ',time datetime NOT NULL COMMENT ' Creation time ',
PRIMARY KEY (id),
KEY itemsListId (itemsListId),
KEY waterproofMemo (waterproofMemo) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
// Sample data INSERT INTO a_itemsListOtherVer VALUES ('zgzrzulitiid', 'vs6h24c5b79w', ' Waterproofing membrane ', '2022-6-16 11:06:41', '2022-6-16 11:06:46');
At present, the running results are more than a few minutes . Database server configuration 2 nucleus 4G
The last version of the transformation is still too laggy
SELECT COUNT(*) FROM a_itemsListVer WHERE ( if(locate(' Waterproof material , Waterproofing membrane ', waterproof)>0 , true ,
if(
locate ((SELECT GROUP_CONCAT(waterproofMemo) FROM a_itemsListOtherVer WHERE itemsListId=a_itemsListVer.itemsListId ),' Waterproofing membrane ' )>0
,true,0 ) ) )
What I want to achieve . Normal operation ,10 End query in seconds
边栏推荐
- 自媒体时代的贤内助——AI 视频云
- China's economy has entered the stage of "the third mock examination coexisting", and JD and Shopify have jointly arranged global DTC
- 【二分】leetcode1011. Capacity To Ship Packages Within D Days
- Hierarchical attention graph convolution network for interpretable recommendation based on knowledge graph
- Configuring multi cluster management using kubectl
- 直接插入排序
- 聊聊内存模型和内存序
- [tcapulusdb knowledge base] [list table] example code of batch deleting data at specified location in the list
- The compatibility of remotefx schemes is related to multiple factors
- Summary of some precautions and problems in the use of tars framework (mengxinxiang)
猜你喜欢

Banknext microservice: a case study

直接插入排序

直接插入排序
![[OWT] OWT client native P2P E2E test vs2017 construction 4: Construction and link of third-party databases p2pmfc exe](/img/cd/7f896a0f05523a07b5dd04a8737879.png)
[OWT] OWT client native P2P E2E test vs2017 construction 4: Construction and link of third-party databases p2pmfc exe

【曾书格激光SLAM笔记】Gmapping基于滤波器的SLAM

Insert sort directly

centos7 安装 MySQL 及配置 innodb_ruby
![Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]](/img/81/4d3cb059f700dd9243645e64023be7.jpg)
Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]

新版kali切换最高账户

HAProxy的编译安装及全局配置段说明
随机推荐
Even if you don't learn gradle, these common development operations are worth mastering
1058 multiple choice questions (20 points)
[tcapulusdb knowledge base] [list table] sample code of asynchronous scanning data
Select sort method
Tcapulusdb Jun · industry news collection (V)
What about the high cost of storage system? The original computer room can save so much money!
[two points] leetcode1011 Capacity To Ship Packages Within D Days
Parsing the implementation of easygbs compatible token as parameter passing
Golang resource embedding scheme
[leetcode] sum of two numbers II
ABCD identifier of SAP mm initial cycle count
Composition and simple classification of IP addresses
Tcapulusdb Jun · industry news collection (IV)
What is the difference between the poll () method and the remove () method?
For patch rollback, please check the cbpersistent log
bubble sort
JS Part 4
Centos7 installing MySQL and configuring InnoDB_ ruby
嵌入式软件测试工具TPT18更新全解析
Frequent actions to expand the scale of new energy industry Guangzhou plans to invest 1.4 billion in photovoltaic power generation projects