sql - MySQL query slow on localhost - mostly network duration -


I am running a very simple query on a indexed column in a 20 mln line table. Select from * to * prvol where date = '20100203';

It takes about 22 seconds to be new to SQL, but it seems that a indexed column should be faster than this. There is no memory issue as well, output says that time is mostly in the network. I am running the query on the machine on which the server is running. 0 lines have been affected, 6,882 rows found. Duration for 1 query: 0.828 seconds (+ 21.438 seconds network) * /

that What does the network mean? Are you expecting this query to run faster?

Edit: According to the request, there is some output here.
  Select Explain * from date of project = '20100203'; "App", "selection", "select", "table", "type", "potential_keys", "key", "key_lan", "referee", "lines", "extra", "1"   

B>

  make table prol; "Table", "Create Table", "Prol", "Make Table" Prol (`Acch 'varchar (10) default faucet,' ticker 'varchar (10) default null,' date 'date default call,' open ' Float unsigned default null, `high` float unsigned default null, floating unsigned default null, float unsigned default null, float unsigned default null, 'echo' float default faucet, 'key' index 1 `Date`)) engine = INNO DB default charset = Latin 1 "   

Yes, absolutely must run faster.

You may have made one of these common errors:

  • You have indexed a column, but it was not the date column .
  • You have created a multicolumn index, but the date column is not the first column in the index and therefore can not be used for this query.
  • You obviously remember to add an indicator, but in some way the index "disappeared" (probably because you run the query and it returns an error but you did not notice the error message).

    To find out that play table project is created and post the output.


    One more thing that you can do to improve the situation is to avoid using the SELECT * . Always select only the columns. Even if you feel that you need all the columns, then in the event of a change in schema in the future, of course, they should definitely be listed for safety.

Comments