How to Determine MySQL Global and Thread Buffers

Asked 2 years ago, Updated 2 years ago, 42 views

When I look online, I find one of the MySQL system variables:
The key_buffer_size and so on are global buffers
sort_buffer_size, etc. thread buffer
It is often called .
Example: http://dsas.blog.klab.org/archives/50860867.html

How do you determine the global buffer or thread buffer?
Thank you for your cooperation.

mysql

2022-09-30 19:21

1 Answers

You should look at the reference to make a decision.
In the linked list, the variable scope says Global, Session, Both, and so on.

Add
As you pointed out, it doesn't say that the scope of the configuration represents the memory area.
Ultimately, the only way to use memory is to look at the source code or check the tuning and benchmarking, but I think you'll have to understand the architecture and look at the references. Oracle's document was easy to understand

As I was curious, I checked how it was written in the document and found out that some global scopes clearly indicate that all threads will be shared, and others do not.
Example) Where you write about key_buffer_size 8.11.4.1.How to use MySQL memory

Also, the session scope estimates that each buffer is reserved for each session (=thread).

This is because the session scope variable can be changed for each connection from the client, and while one client has a sort_buffer_size of 100KB, another client can have a buffer of 2MB.
myThis is why my.cnf, etc., can divide settings by client.

Also, the meaning of the scope of the configuration is written here.
4.2.4.Using System Variables

(I would like to make the tea muddy by pasting various things like that…;)


2022-09-30 19:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.