LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-05-2021, 10:46 AM   #1
Steve R.
Member
 
Registered: Jun 2009
Location: Morehead City, NC
Distribution: Mint 20.3
Posts: 521

Rep: Reputation: 98
MariaDB - Tuning - Setting Server Variables


I appear not to be comprehending how system (server) variables in MariaDB are set. Using Mint 20.1, MariaDB server version: 10.3.29-MariaDB-0ubuntu0.20.04.1 - Ubuntu 20.04

When looking at the results of "Advisor" under the "Status" tab, "Advisor" suggests some revisions. I will only focus on one for now, as once this concern is resolved, solving the rest should follow the same pattern.

Advisor reports:
Quote:
{long_query_time} is set to 10 seconds or more, thus only slow queries that take above 10 seconds are logged.
Solution suggested by Advisor:
Quote:
It is suggested to set long_query_time to a lower value, depending on your environment. Usually a value of 1-5 seconds is suggested.
To implement the solution suggested above, I went to the "Variables" tab under "More" and edited that value to set it to 1. After restarting MariaDB (sudo service mysql restart), I reexamined Advisor. Nothing changed, changes did not take.

After looking around a bit, it appears that many configuration settings are in the file: etc/mysql/mariadb.conf.d/50-server.cnf

A small portion of that file is shown below, where you will see my revisions. None of those revisions had any effect on changing what Advisor was reporting after restarting MariaDB. What have I done wrong?
Code:
# Enable the slow query log to see queries with especially long duration
# Revised 7/5/2021 in response to advisor.
#slow_query_log_file    = /var/log/mysql/mariadb-slow.log
slow_query_log_file     = /var/log/mysql/mariadb-slow.log
slow_query_log          = ON
#long_query_time        = 10
long_query_time         = 1
#log_slow_rate_limit    = 1000
#log_slow_verbosity     = query_plan
#log-queries-not-using-indexes
 
Old 07-05-2021, 12:48 PM   #2
Steve R.
Member
 
Registered: Jun 2009
Location: Morehead City, NC
Distribution: Mint 20.3
Posts: 521

Original Poster
Rep: Reputation: 98
Since posting, as it usually happens, I made some progress, I moved some of the setting to the bottom of the file: /etc/mysql/mariadb.cnf. They took except for "query_cache_limit" (apparently the variable "Qcache_free_memory" no longer exists.). Results do not look promising at this time: "The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. Deprecation includes query_cache_limit.". So why is Advisor making a recommendation for fixing it?

/etc/mysql/mariadb.cnf
Code:
# This is the "replacement" for the MySQL my.cnf file.
# The MariaDB configuration file.
# Planning to use the "/etc/mysql/mariadb.conf.d/50-server.cnf" file to set global options (July 5, 2021).
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

# Configuration values added based on the suggestions of the "Advisor". July 5, 2021
slow_query_log_file     = /var/log/mysql/mariadb-slow.log
slow_query_log          = ON
long_query_time         = 1
#query_cache_limit       = 4.000

Last edited by Steve R.; 07-05-2021 at 02:21 PM.
 
1 members found this post helpful.
Old 07-05-2021, 01:12 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Thanks for posting your progress!

Most of those system variables were set in /etc/my.cnf for many years, but much of that is now under /etc/my.cnf.d/ or similar paths on different distributions such as your /etc/mysql/mariadb.cnf.d/.

The confusion arises from settings in one file overriding those in another, so it is necessary to find the "top" file in the stack which defines some given variable - /etc/mysql/mariadb.cnf in you present case. Check the distro documentation for the rationale, but you might think of those inder /etc/mysql/mariadb.cnf.d/... as the defaults, and /etc/mysql/mariadb.cnf as being the local master which provides a single place to override specific defaults.

Keep us posted!
 
1 members found this post helpful.
Old 07-05-2021, 02:55 PM   #4
Steve R.
Member
 
Registered: Jun 2009
Location: Morehead City, NC
Distribution: Mint 20.3
Posts: 521

Original Poster
Rep: Reputation: 98
I have several MariaDB databases for personal use, all relatively small. MariaDB acted very quickly, so I had not perceived of any concerns until I looked "under-the-hood" with "Advisor". Sometimes, you shouldn't look.

I'm also starting to think that some of the issues that are being reported by "Advisor", such as the deprecated "Query cache" are actually artifacts (false positives) resulting from other issues. One reported issue by "Advisor": "There are too many joins without indexes.". Solving that will require going through the tables to improve them and may "resolve" "Query cache".

I ran across one post that seems to have some good relevant advice. Suggestions to consider for your my.cnf [mysqld] section in case anyone is interested.

I think, as you point out: "The confusion arises from settings in one file overriding those in another, so it is necessary to find the "top" file in the stack which defines some given variable .."; that I finally found the file where the variables are not being overridden by another subsequent file. Since that has happened, this thread is probably solved, but I will let that go for a few days to allow for additional comments. Thanks.

Last edited by Steve R.; 07-05-2021 at 03:09 PM.
 
  


Reply

Tags
mariadb 10, server



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Tuning remote connection PyQT5 to Mariadb on Debian Bullseye LXer Syndicated Linux News 0 06-15-2021 02:55 PM
LXer: Setting up Tomcat 9.0.41 && mariadb-server 10.5 on Debian Bullseye/sid LXer Syndicated Linux News 0 01-18-2021 01:51 AM
LXer: KDE Participating in Google Summer of Code 2019, MariaDB Releasing New Open-Source MariaDB Enterprise Server, CentOS Celebrates 15th B LXer Syndicated Linux News 0 02-28-2019 06:50 AM
LXer: Porting and tuning applications for Linux on Power, Part 2: 15 Porting and tuning tools for Linux on Power LXer Syndicated Linux News 0 05-18-2018 01:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration