I have a simple select statement:
SELECT id1, id2, id3 FROM Table1
Table1 contains around 400,000 records.
Currently, this statement takes 5 seconds to execute.
Is it possible to optimize this (without reducing the number of records returned)?
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.
Add an index with all three fields in it and that will cause SQL to read from the index page. This is also known as a covered index. One thing to remember though is that adding the index can slow down write times because the index has to be rebuilt during a write.
However, with only 400K rows, I would say that’s probably not an issue.