Soar 2000+ insert performance test

2000+ single table FT inserted Performance Test

CREATE TABLE t_data_metric_20200316
(
   c_inst_id INT NOT NULL ,
   c_sub_inst_id INT NOT NULL ,
   c_task_time INT NOT NULL ,
   c_insert_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
   c_metric_id VARCHAR(36) NOT NULL  ,
   c_data_value DECIMAL(20,2) DEFAULT NULL ,
   c_metric_status VARCHAR(20) DEFAULT NULL ,
   c_error_msg VARCHAR(50) DEFAULT NULL ,
   c_data_value_adjust decimal(20,2) DEFAULT NULL ,
   c_data_value_expect decimal(20,2) DEFAULT NULL 
   );
   
   create index idx_backup_data_metric on t_data_metric_20200316(c_inst_id,c_sub_inst_id,c_task_time,c_metric_id);
   CREATE INDEX idx_data_metric_sub ON t_data_metric_20200316 (c_sub_inst_id,c_metric_id,c_task_time);
   CREATE INDEX idx_data_metric_time ON t_data_metric_20200316 (c_task_time);
   

declare
begin
  for i in 1..20000000 loop
     INSERT INTO T_DATA_METRIC_20200316
       (C_INST_ID, C_SUB_INST_ID, C_TASK_TIME, C_INSERT_TIME, C_METRIC_ID, C_DATA_VALUE, C_METRIC_STATUS, C_ERROR_MSG, C_DATA_VALUE_ADJUST, C_DATA_VALUE_EXPECT)
        VALUES(1000+i, 1000+i,1584323799+i , CURRENT_TIMESTAMP, 'test001', 9999.99, 'GREEN', 'test_err', 0, 0);
     if mod(i,2000)=0 then
      commit;
     end if;
  end loop;
end;   



A total of 1 positive statement followed by the implementation ...

[Executing statements. 1]:
DECLARE
the begin
  for 1..20000000 Loop I in
     the INSERT the INTO T_DATA_METRIC_20200316
       (C_INST_ID, C_SUB_INST_ID, C_TASK_TIME, C_INSERT_TIME, C_METRIC_ID, C_DATA_VALUE, C_METRIC_STATUS, C_ERROR_MSG, C_DATA_VALUE_ADJUST, C_DATA_VALUE_EXPECT)
        the VALUES (1000 + I, + I 1000, 1584323799 + I, CURRENT_TIMESTAMP, 'test001', 9999.99, 'GREEN', 'test_err', 0, 0);
     IF MOD (I, 2000) = 0 the then
      the commit;
     End IF;
  End Loop;
End;
successful execution, execution consumption when 519 minutes 48 seconds 18 milliseconds NO: 45
affects a recording

A successful execution
 

 

A total of 1 positive statement followed by the implementation ...

[execute the statement 1]:
DECLARE
the begin
  for i in 1..2000000 Loop
     INSERT INTO T_DATA_METRIC_20200316
       (C_INST_ID, C_SUB_INST_ID, C_TASK_TIME, C_INSERT_TIME, C_METRIC_ID, C_DATA_VALUE, C_METRIC_STATUS, C_ERROR_MSG, C_DATA_VALUE_ADJUST, C_DATA_VALUE_EXPECT)
        the VALUES (1000 + I, 1000 + I, 1584323799 + I, CURRENT_TIMESTAMP, 'test001', 9999.99, 'GREEN', 'test_err', 0, 0);
     IF MOD (I, 2000) = 0 the then
      the commit;
     End IF;
  Loop End;
End;
successful execution, time-consuming 1 minutes 26 seconds 24 milliseconds NO: 11.
Effect of a recording

a successful execution

Published 15 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/myth8860/article/details/104893691