I'm wondering if it would be better to use a single query and SELECT more data than I might need, or use multiple queries and SELECT only what I need when I need it. For example when the client submits a username and password, my PDO query string is this:
$sql = "SELECT passwordHash FROM users WHERE username=:username";
Then in PHP I verify the submitted password against the hash. If it succeeds, I do more queries to get more data like name and address. But would it be better to add those to my initial password hash query so that I'll already have it in the likely event that the password matches? That way I'd save a query. If the password is wrong though, I'd be wasting that lookup of extra information. In general, would it be better to do less queries and get more data each time, possibly more than necessary, or to do more queries and only get exactly the data I need each time?