简体   繁体   中英

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?

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.

Having another database with column store in favor of row based processing as in MySQL, the second approach might is faster. 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.

So there is no real, clear: Do it like that and you will be happy for ever.

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