query efficiency

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is a general question that I have wondered about from time to time but
have never seen discussed in the books I have read. I will give an example
to illustrate the idea

SELECT * from tblEveryOneIntheWorld
WHERE Grandfather is true and Age > 20 and Sex = male

The last two contraints in the Where clause are clearly unnecessary when
looking for grandfathers but they could be used to reduce the set of records
to search for grandfathers. My question is the general one of whether it is
better to tell the query everything one knows or to leave it at the minimal
set of criteria that will solve the query? In this case, the test for
grandfathers is just a boolean search but this type of question comes up from
time to time when the cost of testing for the necessary part of the "where"
is not minimal, eg involving joins, etc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top