What size of a large considerable query?

6

What size of a large query ? I need to make a function to send query to the server but I can not exceed the limit to not crash the server:

public function sqlExecute($sql_code) {
    if ($sql_code != "" && strlen($sql_code) < 1e6) { // O TAMANHO DA QUERY AQUI
        echo '1';
    }
    else {
        echo '2';
    }
}
    
asked by anonymous 05.04.2015 / 01:37

1 answer

9

In MySQL you can check this with:

SHOW VARIABLES WHERE Variable_name = "max_allowed_packet";

This same variable can be changed in my.ini or my.cnf . It can be up to 1GB but is likely to be set to default with 1MB.

That is, you do not have much to worry about in most cases except changing the value of this variable, if necessary, which will rarely be. If a very large size is required one should think about whether that solution is ideal.

    
05.04.2015 / 02:03