简体   繁体   English

如何用 MySQL 计算效率

[英]How to calculate efficiency with MySQL

I've got a simple but important question.我有一个简单但重要的问题。 When I'm getting information from MySQL and I want my website to be fast: Does the amount of select statements matter or just the amount of data I'm selecting?当我从 MySQL 获取信息并且我希望我的网站速度快时:选择语句的数量重要还是我选择的数据量重要?

Are those 2 examples are very different?这两个例子有很大不同吗? (pseudo code) (伪代码)

select row1, row2, row3, from movies

or或者

select row1 from movies
select row2 from movies
select row3 from movies

Choose the solution that looks more sane.选择看起来更理智的解决方案。

And bother yourself with efficiency question only when you face inefficiency.只有当您面临效率低下时才会为效率问题而烦恼。

On MySQL the first query will be most likely the faster approach.在 MySQL 上,第一个查询很可能是更快的方法。

Having another database with column store in favor of row based processing as in MySQL, the second approach might is faster.拥有另一个具有列存储的数据库以支持在 MySQL 中基于行的处理,第二种方法可能更快。 But this of course is depeding on both sides how your where is looking like.但这当然取决于双方的情况。

Also it depends on how you run the queries: Eg having a abstraction layer able to run different queries at the same time -- again depending on your where clause eg -- the second approach could be also better than the 1st one, as you are not limited by one connection.还取决于您如何运行查询:例如,具有能够同时运行不同查询的抽象层 - 再次取决于您的 where 子句,例如 - 第二种方法也可能比第一种更好,就像您一样不受一种连接的限制。

So there is no real, clear: Do it like that and you will be happy for ever.所以没有真正的、明确的:这样做,你会永远快乐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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