Problems with MariaDB, slow query

0

On the server I have two databases. db production and db_test production, the two are the same in fields, tables, relationships, etc, since tests are done with db_test production. The problem arises when I want to make a simple query in PHPMYADMIN, a select with two conditions. In the production brings 150 records and in the test brings 183 records, to compare the execution time of the query in the two databases. In the production, which users use constantly delays in bringing the 150 records to about 8 seconds and the test takes 1 second. My question is: Should not they take a very similar time, since it is the same server that responds? What is the problem and possible solution?

    
asked by Jeison Gonzalez 26.02.2018 в 21:36
source

1 answer

0

A lens inquiry may be due to several factors.

The number of total records in the table, even though I show you about 150-183 records, you may have more than 10,000 records in one database and 1,000 in the other. The query has to go through all the records as well. What is the number of records you have in each table?

The records can be blocked by queries from other users, when a user queries a record that registration is blocked, and until it has all the data does not unlock it and therefore at that time is not available, and that can delay the query. I would test the production DB in an environment if more users, to see if that is the problem.

    
answered by 24.05.2018 в 17:22