Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
mysql クエリにかかる時間を追跡するために使用できるものはありますか? >一定の時間がかかる場合は、おそらくそれらをログに記録しますか?またはすべてのクエリを追跡し、最長のクエリ時間のみを保持しますか? ASP.NET を使用した C# .NET でこれを使用します。
これを使用して、クエリが遅くなっているかどうかを時々確認したいと思います。
これは、サーバー上で行うのが最適です。
MySQL では、X 秒 (X を指定する場所) より長くかかるクエリを、特別な低速クエリ ログに記録できます。
my.cnf ファイルの [mysqld] セクションの下に、好みに応じて以下を追加および変更します。
log_slow_queries = /var/log/mysql/mysql-slow.log #where to log long_query_time = 2 #time in seconds
http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html