I’ve heard that mysql queries are very expensive, and that you should avoid at all costs making too many of them.
I’m developing a site that will be used by quite a few people, and I’m wondering:
How expensive are mysql queries actually? If I have 400,000 people in my database, how expensive is it to query it for one of them?
How close attention do I need to pay that I don’t make too many queries per client request?
Edit: TomTom couldn’t be more correct with his answer. According to perormance tests on the sites linked to in the comments (and a couple sites I found through a “mysql queries per second” search), I won’t be encountering problems for quite a while – mysql can do thousands of queries per second with a remote server.
Just ignore it. Seriously. If you need data, you need data. Make sure your queries are reasonable fast (i.e. proper indices). Get a proper server for handling the load. Use output caching as makes sense, start caching data once you know where you actually HAVE a problem.