Hey.

Question by mysql. Reached variables and stored procedures. Here is the source http: //xn----9sbcmrygis2b.xn--p1ai/mysql/ANSI_diff_Triggers.html . I realized that there are two types of variables: user variables and stored procedure / function variables. The programmer creates these variables by hand. User variables are issued inside the procedure / function, but stored procedure / function variables are not visible from the outside. That is, the concept of scope in mysql also works + should still be, in theory, the namespace (as in other programming languages) of the global code and the local procedure / function code. What is the namespace in mysql?

I do not understand about system variables. They write that the MySQL server supports a large number of system variables with the help of which you can make the so-called "fine tuning". To get a complete list of system variables in the console client mysql, you can use the SHOW VARIABLES command;

They write that there are two types of system variables: flow-specific (or for a connection; we hereinafter call them flow variables for short) that are unique to a given connection and global variables that are intended to control global events. Global variables are also used to set default values ​​for corresponding stream variables for new connections.

This is not clear to me - why did the system variables be divided into session and global system variables?

Why do these system variables come up, if you can get into my.ini and configure everything?

What place (where do they lie) do these system variables occupy in the namespace?

It is impossible to "sort through" what is in mysql.

    1 answer 1

    This is not clear to me - why did the system variables be divided into session and global system variables?

    So that, if necessary, it was possible to change their values ​​for the session (for example, the data encoding or the isolation level there). Admit that for each setting, it is wasteful to create your own server instance ...

    Why do these system variables come up, if you can get into my.ini and configure everything?

    Where do you think the values ​​of global variables come from? something is written by hardcode, of course, but not everything will suit you, as is done by default ...

    What is the namespace in mysql?

    Yes, there is global space, common for the server - there are global variables. There is session space, one for the session - there are session variables and user variables. And there is the local space of the procedure / function where local variables lie, incl. and variable parameters.

    • Well, in general, there is nothing special. Everything is simple and completely standard. - Akina
    • thanks for the answer. interesting is obtained. There are already three namespaces - global, session and the namespace of the procedure / function - Dimon
    • "for each setting, it would be wasteful to create your own server instance" - what is a server instance? - Dimon
    • one
      This is another server instance (process, service) in the same copy of the OS. How can I run multiple copies of application software, so in principle with services, incl. and with the MySQL server (with the only difference that they will need to be configured so that they do not interfere with each other). - Akina
    • one
      The built-in functions and the connected UDFs are in the global osprey, the user functions are in the osprey schema (see INFORMATION_SCHEME.ROUTINES). - Akina