Improve number of queries to DB

Emanuel Wasinger 4 years ago 0


I am using GLPI 9.4.3 and GLPI 9.4.4. I have noticed that performance has declined and I think I know why.

In a fresh installation GLPI needs 66 queries to DB to show the tickets list window (without tickets).

For do that, it need to open 3 sessions to DB.


When 1 ticket is load, GLPI needs 76 queries to DB to show the ticket list window (with 1 ticket).

Again, for do that, it need to open 3 sessions to DB.


When 2 tickets are load, GLPI needs 84 queries to DB to show the ticket list window (with 2 ticket) and open 3 sessions.

This behaviour produce that when the tickets number increase, the number of queries to DB increase too.

In addition, some queries are repetead several times.

For example, the queries to load users' data are repeated for every time that the user have to be showed in the tickets list (like requester, observer or technician).

Maybe you can save user information in an array on the first search and check there every time the user must be showed more than once.

I think that is important reduce the number of queries because in a production environment, to display a list with 15 tickets, GLPI needs to make about 900 queries to the database.


And finally, having the genericobject plugin activated with 80 types of objects approximately, GLPI needs to do almost 11200 queries to the bd to show a list with 15 tickets. In this case, some queries are repeated more than 1000 times.


I await your comments.

Best regards.