Mysql query logging

I am going to start developing a logging system for future implementation in the current PHP application to get download and usage statistics from the MYSQL database.

Then the statistics will be used to obtain information about database calls per second, query time, etc.

Of course, this will only be used when the application is in the testing phase, as it will certainly cause a bit of extra workload.

However, my biggest question now is if I should use MYSQL to register queries or for the file system. I suppose it would be a headache to create something that would allow you to write notes from multiple places when using the file system to process logs?

How do you do this?

+3
source share
5 answers

MySQL has already integrated the log into chapter 5.2 of the manual. You will probably be interested in the general query log (all queries), the binary query log (queries that change data) and the slow log (queries that take too long or don't use indexes).

, , , . , , devel, , db . , , MySQL ( , ). MySQL - SQL-, SUM AVG, .

+3

, MySQL. ( , ), , .. , , .

+3

If you are running tests in MySQL, you must store the results in another database, such as this Postgres, so you won’t increase the load with your operations.

+1
source

I agree with macabail, but add that you can link this to a cron job and a simple script to extract and generate any statistics you may want.

0
source

Source: https://habr.com/ru/post/1730409/


All Articles