mysql - understanding indexs with a simple select query -
mysql - understanding indexs with a simple select query -
i'm trying understand how work indexes basic queries.
example:
i have table 'testme' next columns:
id int primary key username varchar(20) data1 int data2 int data3 int data_order int
if
select username,data1,data2 testme data3=5 order data_order;
which kind of indexes can utilize speed query ?
i tried adding index on clumns data3 , data_order result of 'explain' query shows doesn't utilize index.
update: using mysql cluster (ndb)
think of index 2 things... 1. order in info stored 2. quick way lookup specific pieces of info (like book index)
in example, having index on (data3, data_order)
create easy find info want, , have in right order.
it still needs go table after searching index, fields username, data1, data2
. reason may include
them in index well. makes index bigger, using more space , more effort update. cost means index isn't beingness joined table. it's reading index.
mysql sql indexing query-optimization
Comments
Post a Comment