The more you want in MySQL the greater the consumption?

-2

I am developing a website and my code is using many queries / queries in MySQL at once, I am trying to decrease these queries to the smallest number since I think the more queries the more resources will be consumed, am I right? >

Example 1:

$busca = $conexao->query("SELECT nome FROM graficos");
$busca2 = $conexao->query("SELECT nascimento FROM graficos");

Example 2:

$pegadeumavez = $conexao->query("SELECT nome, nascimento FROM graficos");

Would Example 1 have the same consumption as Example 2? I say any type of consumption like RAM, CPU, bytes, processing, etc.

    
asked by anonymous 02.03.2017 / 01:31

1 answer

-1

Good evening the idea is very simple ... the more you condone your query (that is, the more data you can get at once) the better the bottleneck that applications have today is the so-called Server Round Trip, that is the amount gone to the server to pick up data, the less times the better. Of course it's up to common sense not to make a mega consutla that returns a zillion lines, if possible break into small loads. But I answer, yes, the more data in a single query, the better the performance of your application.

    
02.03.2017 / 02:51