简体   繁体   中英

Do MySQL tables have a performance effect on each other?

I will have a few large tables where i'm only going to insert new rows. I'm also going to have one small table used for authentication. My question is will those big tables have a performance impact on this small one? Or are tables performances independent from each other?

Thanks.

If you are creating joins between those tables or using them in queries, there will be a performance hit. Otherwise, individual tables should not affect the performance of executing statements on other tables in MySQL if I am correct.

For the chance that you might be joining or referencing columns across large tables, you should index your tables using foreign key constraints.

I think there is no real independence in term of performance between tables. The term performance is related to work of database process and your server

Giving an example, If you have 2 separate process that work simultaneously. One has heavy work on big table and another only have little work on small table. The heavy one may cost almost your server resource (CPU, disk, etc vv..) and cause the little one timeout. So they still affects each others if they work together

And certainly, If your process work on separate table in sequence they doesn't affect each others

Tables by themselves don't have performance. Whether a table is large or small, it doesn't do anything by itself.

You're really asking if queries against these tables impact one another.

Yes, they do. There's a finite amount of capacity on a given server for running queries. You have a fixed number of CPU cores, and some amount of physical RAM to store in-memory cached pages, and disk I/O can be saturated on a busy system.

The limits of your server to run queries has little to do with how big the tables are. You can run quick queries against big tables, and you can run very costly queries against small tables.

It depends more on how many queries you run concurrently, and how complex and resource-intensive the queries are. But yes, definitely queries can impact one another because they're all competing with each other to use system resources—primarily CPU, RAM, and disk bandwidth.

This is why it's important to optimize queries by adding indexes, or caching query results, or even change the SQL code for query logic to be more efficient.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM