Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

Performance testing in MYSQL giving same result

I am developer and working on performance improvment on MySQL queries. The flow is full load in 2 stages. First query will read FILES table and load into TABLE_STAGE table with full delete and in 2nd level also it read from TABLE_STAGE to TABLE_MAIN table. First delete it and then select all the records.

delete from TABLE_STAGE
select from FILES 
delete from TABLE_MAIN ;
insert into TABLE_MAIN from select * from TABLE_STAGE

As a first part of step i have replaced delete with truncate . It improved performance immediately , but when i using delete again , performance is same ,the time is not increasing. I am not getting the reason behind this why it is showing the same result..

question from:https://stackoverflow.com/questions/65845230/performance-testing-in-mysql-giving-same-result

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Don't use DELETE, it is slow.

CREATE TABLE new LIKE real;
LOAD DATA INFILE INTO new (or use batched insert)
RENAME TABLE real TO old,
             new TO real;
DROP TABLE old;

(I don't understand where your FILES table is used.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...