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.
One component you should look at is “query cost.” Query cost refers to how expensive MySQL considers this particular query in terms of the overall cost of query execution, and is based on many different factors. Simple queries generally have query cost of less than 1,000.
Five types of SQL queries are 1) Data Definition Language (DDL) 2) Data Manipulation Language (DML) 3) Data Control Language(DCL) 4) Transaction Control Language(TCL) and, 5) Data Query Language (DQL)
Ultimately, speed will depend on the way you're using the database. PostgreSQL is known to be faster for handling massive data sets, complicated queries, and read-write operations. Meanwhile, MySQL is known to be faster with read-only commands.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With