Configuring your database server
Find out how to configure and optimise your database server
Find out how to configure and optimise your database server
Last updated 30th June 2022
With the CloudDB database servers, you can influence your server’s global settings. You can also view your server's activity.
Find out how to configure and optimise your database server.
In your OVHcloud Control Panel, go to the Databases
section, then select the SQL instance concerned. Click on the General information
tab.
You can also view important information on your SQL instance. Please take a few moments to ensure that the information displayed is correct, and corresponds to the instructions below.
Information | Details |
---|---|
Service status | Mainly shows if the instance has been rebooted, is in the process of rebooting, or is suspended. Your instance must be rebooted if you need to carry out any actions. |
Type | Shows the database system used by the server. If you are unsure if the correct type is being used, please note that the most common version is “MySQL”, but other types also exist (PostgreSQL, MariaDB). For example, if you are using WordPress for your website, a MySQL system is perfect for it. |
Version | Shows the database system version used by the server. Check that your website is compatible with the version you have chosen. |
CPU throttling | Displays the CPU time spent in saturation over the last 24 hours. |
RAM | Shows the RAM available for your instance, also shows if you are close to exceeding the RAM limit. Your database server has dedicated, guaranteed resources: its RAM. If required, you can scale the RAM, and receive warnings if you are consuming all of your instance’s RAM resources. |
Infrastructure | Shows the infrastructure used by your instance. This information is inherent to the OVHcloud infrastructure. |
Datacenter | Shows the data centre in which the instance has been created. Verify that your instance is hosted in is the same data centre as the OVHcloud Web Hosting plan that your website is based (or will be based) on. |
Host | Shows the OVHcloud server your instance has been created in. This information is inherent to the OVHcloud infrastructure, and can be used in our communications on OVHcloud incidents. |
You can access your CloudDB from your OVHcloud web hosting plans or from the public network.
In order for your CloudDB instance to be accessible, you must enter the IP addresses or ranges that can connect to your database.
In your OVHcloud Control Panel, go to the Databases
section, then select the CloudDB instance concerned. Click on the General information
tab.
To do this, click on the Authorised IPs
tab, then click Add an IP address/mask
.
In the window that pops up, enter the IP address or mask that you wish to authorise IP/mask
, together with a description, if you wish. You can then decide if you want to grant access to the databases only, or to the SFTP as well. Finally, click Confirm
.
For an OVHcloud web hosting plan, you can simply tick Authorise OVHcloud web hosting plans to access the database
.
To modify the solution for your CloudDB instance, go to your OVHcloud Control Panel. Click the Web Cloud
tab, and then click Database
. Select the name of your database server.
In the General information tab, displayed by default, click on ...
to the right of “RAM”, then on Change the amount of RAM
to access the order for this modification.
Choose the amount of RAM you want, then click Next
. You can then choose the duration you want.
The remaining term until expiration will be prorated. This pro rata calculation will be based on the expiration date of the CloudDB instance, not on the date of the purchase order.
Once you have confirmed your contracts, you will be redirected to the purchase order to pay for this change. It will then be effective within a few hours.
If you currently have a free CloudDB with your Performance hosting plan, it will no longer be free after modifying the plan.
In your OVHcloud Control Panel, go to the Web Cloud
section, and then click Databases
. Select the name of your CloudDB server.
Configuration
tab.In the General configuration of MySQL box, you will see the configuration currently set for your database. You can modify it directly, then click Apply
.
When you encounter an error on your website stating "Too many connections", this is due to the number of simultaneous connections on your database server being exceeded. You can then increase the MaxConnections variable if it is not at its maximum.
Tmpdir:
/dev/shm: The database server will allocate half of its RAM to this directory for higher performance.
/tmp: The server will allocate unlimited space on its hard disk for this directory, but this will be much less efficient. We recommend using this directory only for occasional heavy operations.
sql_mode:
Default mode of MariaDB 10.1:
NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
Default mode of MariaDB 10.2 and higher:
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Default mode of MySQL 5.6:
NO_ENGINE_SUBSTITUTION
Default mode of MySQL 5.7 and higher:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
We recommend always using the default mode, unless your database was updated from a version with a default mode that is different from the current version.
Make the necessary changes, then click Confirm
.
Any changes require a restart of the database server.
You cannot modify the configuration of a PostgreSQL instance.
However, you can enable extensions for your databases. To do this, go to the Databases
tab, and click on the table icon for your database in the Extensions column.
To find out the version of MySQL, PostgreSQL or MariaDB of your database server, you must go to the General information tab after choosing your database server.
The current version appears in the Version row.
To edit this version, click Update version
.
Enter this command in phpPgAdmin by clicking on Your database in the SQL section, then click Launch
:
select version();
To do this, enter this command in phpMyAdmin, in the SQL section, then click Run
:
show variables like "version";
It is not possible to switch from an old version to the latest version directly. It is mandatory to use all intermediate versions.
This allows you to view the query execution time on your database server in the last 24 hours.
In your OVHcloud Control Panel, go to the Web Cloud
section, and then click Databases
. Select the name of your CloudDB server.
Go to the Metrics
tab for your database server. You will find the graph Query Execution Time Statistics.
Definition of slow query log
These are the queries that take longer to run. The value is set to 1 second on our database servers in the variable “long_query_time”.
These logs, labelled "slow-query.log", can be retrieved from the root of the SFTP space of your database server.
In your OVHcloud Control Panel, go to the Web Cloud
section, and then click Databases
. Select the name of your CloudDB server.
In the General information
tab, you will find the SFTP section in the Connection information box.
To log in via SFTP, you can do so via the FileZilla software, using this guide.
If this file is empty, you do not have any slow queries.
In your OVHcloud Control Panel, go to the Web Cloud
section, and then click Databases
. Select the name of your CloudDB server.
Go to the Metrics
tab in the OVHcloud Control Panel. You will find the graph RAM usage statistics.
This graph allows you to track, over the last 24 hours, the load of connections per minute on your database server.
In your OVHcloud Control Panel, go to the Web Cloud
section, and then click Databases
. Select the name of your CloudDB server.
Go to the Metrics
tab in the OVHcloud Control Panel. You will find the graph Statistics for total connections per minute.
It is recommended that you maintain your database to ensure high performance. Performance refers to the fact that the information contained in the database is most quickly returned to the script that requests it. This requires a structured and optimised database.
To increase the speed of searches during a query, you must index the fields that are used in WHERE clauses.
Example: you do a regular search for people in relation to the city. Index the “city” field with the following query:
ALTER TABLE 'test' ADD INDEX ('city')
Some of your data is no longer being accessed? By archiving it, your tables will be less crowded and searches will go faster.
Limit the display of records to a fixed number (for example: 10 per page) with the "LIMIT" portion of your SQL query.
Group your queries at the beginning of the script this way:
open_connection
request1
request2
...
close_connection
Display...
Treat data
Loop through data...
Display...
...
In your SQL queries, make sure you select only what you need, and especially that you have not forgotten the links between the tables.
Example:
(where table1.champs = table2.champs2)
Avoid using "HAVING" for example. It increases your requests. Similarly, avoid using “GROUP BY”, unless it is strictly necessary.
IP address list for Web Hosting clusters
Join our community of users on https://community.ovh.com.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community