I have about 1 million rows so its going pretty slow. Here’s the query:
$sql = "SELECT `plays`,`year`,`month` FROM `game`";
I’ve looked up indexes but it only makes sense to me when there’s a ‘where’ clause.
Any ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Indexes can make a difference even without a
WHEREclause depending on what other columns you have in your table. If the 3 columns you are selecting only make up a small proportion of the table contents a covering index on them could reduce the amount of pages that need to be scanned.Not moving as much data around though, either by adding a WHERE clause or doing the processing in the database would be better if possible.