Home > database >  Mysql under what circumstances, please add the indexing speed slower instead?
Mysql under what circumstances, please add the indexing speed slower instead?

Time:12-23

If involves disk read and random sequence, but hasn't been too understand, what bosses can give small white about [face] monkey2:053 PNG [/face] [face] monkey2:053 PNG [/face] [face] monkey2:053 PNG [/face]

CodePudding user response:

 select val_1, avg (val_2) 
The from big_table
Where val_3=1
Group by val_1


Big_table article to tens of millions of data query speed before add index more than 4 s, but after add the index:
 the create index i_2 on big_table (val_3 val_1); 

Query speed dropped more than 9 s,,,,

This is why ah,,,

CodePudding user response:

The execution plan left

CodePudding user response:

Tens of millions of data, if val_3=1 than big , then this index is not worth it,
As table scan before indexing, instead

CodePudding user response:

reference gypsy song reply: 3/f
, tens of millions of data if val_3=1 than big , then this index is not worth it,
As before indexing table scan, instead

The Numbers are randomly generated, so than should be no big, some one percent,,,,

CodePudding user response:

Should not, stick of come out to have a look at it

CodePudding user response:

refer to 6th floor gypsy song response:
without should stick of come out to have a look at it


Proportion is 0.5%

CodePudding user response:

Emmm changed after the index now I run fast thief
 the create index i_2 on big_table (val_3 val_1, val_2); 
running time of 0.03 s
  • Related