Home > database >  Inserted into A table B in the table, select effective column and drop extra columns, the faster?
Inserted into A table B in the table, select effective column and drop extra columns, the faster?

Time:10-08

A:
Insert into the select a, b, b, c from a;
The second way:
The alter table a drop the column b;
Insert into the select * from a b;
The faster? Why is that?

CodePudding user response:

Lz this article 641 w data, a method to use 353 + seconds, mode 2 with 190 + seconds, only solution, the second way to run the first

CodePudding user response:

Way for a faster
Reason: the way the second drop column takes time, not a table of shrinking and the way the table section of the same size, that is they are using the same data block,
The original poster can be a more detailed description of a scene

CodePudding user response:

Sorry ah, now see, as a rule, I also think that a faster way, just met the phenomenon at that time, a little uncertain, to say the specific scene, is now often have table minus a few fields to get another one table, because the same library is thinking about writing SQL processing, may be I, the data quantity is less, have the opportunity to get a large quantity of data to test the
refer to the second floor riven2011 response:
way for faster
Reason: the way the second drop column takes time, not a table of shrinking and the way the table section of the same size, that is they are using the same data block,
The original poster can be a more detailed description of a scene

CodePudding user response:

Rightness, forgot to say, the 4.51 million data, the data structure is simple, and repeat, is the product of lz repeat insert, may cause the result
  • Related