Enable Logging of Slow Queries (Slow Query Log) in MySQL Database تمكن من تسجيل بطيئة للاستعلامات (بطيئة الاستعلام سجل) في قاعدة البيانات ماي. س. ك
One of the main requirements for a fast واحد من المتطلبات الرئيسية لسريعة web server ملقم الويب is to has efficient and effective SQL statements or queries that are optimized. هو قد كفاءة وفعالية مزود بيانات أو الاستفسارات التي هي الأمثل. Any non-optimal SQL (Structured Query Language) commands or statements that take too long or lengthy time to execute will use up a lot of system resources, causing أي غير مزود الأمثل (المنظم استفسار اللغة) الأوامر أو البيانات التي تأخذ وقتا طويلا أو طويلة من الوقت لتنفيذه سوف يستخدم ما يصل الكثير من موارد النظام ، مما تسبب MySQL ماي. س. ك database to run slower, and then more and more queries backlogs queuing up, and when connection limit is reached, visitors are been denied or refused connection. قاعدة بيانات لادارة ابطأ ، وبعد ذلك المزيد والمزيد يقف في طابور أمام تراكم الأسئلة ، وعندما يتم التوصل الى الحد الصدد ، الزوار حرم او رفض الصدد. In worst case scenario, your web server will go down as well, or continuously underperform. في أسوأ سيناريو ، خدمة الويب الخاص بك سوف تنخفض ايضا ، او باستمرار منقوصا. The case is especially true when you are using MyISAM table type which uses table-level locking instead of row-level locking in a high traffic website. الحال ينطبق بشكل خاص عندما كنت تستعمل MyISAM نوع الجدول الذي يستخدم الجدول المستوى قفل بدلا من الصف المستوى الإقفال ارتفاع حركة المرور في الموقع.
Sometime, a single SQL query may be the cause of all the server’s problems. وقت ما ، مزود استفسار واحدا قد يكون سبب كل مشاكل الخادم. MySQL has built-in functionality to capture slow query log or identify queries that are not optimal and take a long time to finish, which allows you to log all slow running queries which took over defined number of seconds to execute by MySQL database engine to a file. ماي. س. ك بنت في الأداء الوظيفي للقبض على بطء استفسار سجل أو تحديد الأسئلة التي ليست الأمثل ويستغرق وقتا طويلا للانتهاء ، الذي يتيح لك تسجيل الدخول إلى بطء تشغيل جميع الاستفسارات التي استولت على عدد محدد من ثانية لتنفيذه من قبل ماي. س. ك محرك قاعدة البيانات إلى ملف. Slow query log is not activated or on by default MySQL installation, thus it is one of the less-used logs. بطء استفسار سجل ليست على تفعيلها أو تقصير من جانب تركيب ماي. س. ك ، وبالتالي هي واحدة من أقل تستخدم جذوع الأشجار.
To enable slow query log, simply add the following line to MySQL configuration file (my.cnf or my.ini), and then restart the MySQL server: لتمكينها من بطء استفسار سجل ، ببساطة إضافة السطر التالي إلى ملف التكوين ماي. س. ك (my.cnf أو my.ini) ، وبعد ذلك استئناف ماي. س. ك الخادم :
log-slow-queries الدخول إلى بطء الاستفسارات
or أو
log-slow-queries = [path to the log file] وغاريتمي بطيئة استفسارات = [الطريق إلى ملف الدخول]
Replace [path to the log file] with actual path to the slow query log file you want the MySQL to write the log to, which is the optional value. يستعاض عن [الطريق إلى ملف الدخول] مع الطريق الفعلي لبطء استفسار سجل الملف الذي تريد ماي. س. ك لكتابة لتسجيل الدخول ، الذي هو قيمة اختيارية.
Or you can start mysqld with with the –log-slow-queries[=file_name] option to enable the slow query log. أو يمكنك البدء مع mysqld مع تسجيل حركة بطيئة - الاستفسارات [= FILE_NAME] الخيار لتمكين بطء استفسار سجل. In both syntaxes, if not log file name is specified, the default name is host_name -slow.log, stored in the MySQL data file directory. في syntaxes على حد سواء ، إن لم يكن سجل اسم الملف هو محدد ، الافتراضي هو اسم host_name - slow.log ، المخزنة في دليل ملف بيانات ماي. س. ك. If a filename is given, but not as an absolute pathname, the server writes the file in the data directory too. إذا كان اسم الملف ويرد ، ولكن ليس مسار المطلقة ، الخادم يكتب الملف في دليل بيانات للغاية.
After enabling slow query log, MySQL will create, capture and log to the log file with all SQL statements that took more than long_query_time seconds to execute, which is by default set to 10 seconds. بعد تمكين بطء استفسار سجل ، سيخلق ماي. س. ك ، والقبض على سجل لملف الدخول مع كل مزود البيانات التي استغرقت أكثر من ثوان لتنفيذ long_query_time ، الذي هو بشكل افتراضي لمجموعة ال 10 ثوان. The time to acquire the initial table locks is not counted as execution time. في الوقت للحصول على الجدول الأولي لأقفال لا يعتبر وقت التنفيذ. mysqld writes a statement to the slow query log after it has been executed and after all locks have been released, so log order might be different from execution order. كتب mysqld بيان لبطء استفسار سجل بعد أن تكون قد أعدم وبعد كل أقفال تم الافراج ، حتى من أجل تسجيل الدخول قد تكون مختلفة من أجل التنفيذ.
You can then examine all the SQL queries that took longer than the pre-defined number of seconds (10 seconds by default) in the host_name -slow.log, and then take the necessary steps to optimize the SQL statements. يمكنك بعد ذلك دراسة جميع الاستفسارات مزود أن استغرق وقتا أطول من المحددة سابقا لعدد من ثانية (10 ثانية بشكل افتراضي) في host_name - slow.log ، وبعد ذلك اتخاذ الخطوات اللازمة لتحقيق أقصى مزود بيانات. The slow query log will tell you about what was time the query completed, how long the query took to run, how long it took to secure its locks, how many rows were sent back as a result, how many rows were examined to determine the result, which database was used, and the actual query itself. بطء استفسار سجل وسوف اقول لكم ما هو الاستعلام الانتهاء من الوقت ، كم من استفسار الى البعيد ، والمدة الزمنية التي يحتاجها لضمان أقفال ، وعدد الصفوف أعيدوا ونتيجة لذلك ، كم عدد الصفوف وكانت دراسة لتحديد ونتيجة لذلك ، والتي كانت تستخدم قاعدة بيانات ، والفعلية على استفسار نفسها. But bear in mind that a SQL query contained in the log may have already optimum, but executed slowly due to the system resources been used up by the actual slow statement that need to be fine tuned. ولكن أن تضع في اعتبارها أن مزود استفسار الواردة في سجل قد يكون بالفعل الأمثل ، ولكنه ينفذ ببطء نتيجة لنظام الموارد المستخدمة حتى من جانب الفعلية بطيئة بيان أن الحاجة إلى تدقيق.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. هام : هذه هي آلة الصفحة المترجمة التي تقدم "كما هي" دون ضمان. Machine translation may be difficult to understand. الترجمة الآلية قد يكون من الصعب فهم. Please refer to يرجى الرجوع إلى original English article المادة الانكليزية الأصلية whenever possible. كلما كان ذلك ممكنا.
Share and contribute or get technical support and help at وحصة المساهمة أو الحصول على الدعم التقني والمساعدة في My Digital Life Forums بلادي الرقمي الحياة المنتديات .
Related Articles المواد ذات الصلة
- Change or Set MySQL Long Query Time Value for log-slow-queries تغيير أو مجموعة ماي. س. ك الاستعلام القيمة الزمنية الطويلة لوغاريتمي بطيئة الاستفسارات
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 تثبيت خادم الويب في ويندوز إكس بي مع Apache2 ، PHP5 وMySQL4 -- الجزء 4
- Change and Reset MySQL root Password التغيير وإعادة ضبط كلمة السر ماي. س. ك الجذر
- How to Backup and Restore (Export and Import) MySQL Databases Tutorial كيفية النسخ الاحتياطي واستعادة (التصدير والاستيراد) وقواعد البيانات ماي. س. ك أمثلة توضيحية
- WordPress MySQL SQL Query Error in WPDB Class ووردبرس] ماي. س. ك مزود استفسار خطأ في الطبقة WPDB
- You Are Not Authorized to Execute SQL Queries in vBulletin Maintenance انت لم تأذن لتنفيذ مزود الاستفسارات في الصيانة إدارية
- MySQL Database Performance Tuning Best Practices Video Tutorial ماي. س. ك ضبط أداء قاعدة بيانات أفضل الممارسات فيديو تعليمي
- Using PHP-MySQL Persistent Connections to Run WordPress Blog PHP - باستخدام وصلات ماي. س. ك المستمرة لادارة ووردبرس] بلوق
- How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog كيفية قراءة ملفات سجل ثنائي ماي. س. ك (BinLog (مع mysqlbinlog
- How to Bypass and Stop Automatic Logon to Log On as Different User وكيف تجاوز إيقاف تلقائي الدخول إلى الدخول مختلفة المستخدم

































January 23rd, 2007 00:22 كانون الثاني / يناير 23rd ، 2007 00:22
[...] If you enable slow queries log of MySQL database server, you will notice that from the slow query log file contains only SQL statements and queries that took more than query_time of 10 seconds to execute or run. [...]إذا كنت بطيئة الاستفسارات التي تمكن من تسجيل الدخول خادم قاعدة البيانات ماي. س. ك ، ستلاحظ أن من بطء استفسار سجل الملف لا يتضمن سوى مزود البيانات والاستفسارات التي استغرقت أكثر من query_time من 10 ثوان لتنفيذ أو البعيد. This is the default value or query time threshold for log_slow_queries function, which is 10 seconds. وهذه هي القيمة الافتراضية أو استفسار عتبة الوقت لlog_slow_queries وظيفة ، وهو 10 ثانية. 10 seconds is way too long for a SQL query to complete, so the value may be too high to capture any meaningful data. 10 ثانية هو الطريق طويل جدا لمزود استفسار لاستكمال ، بحيث قيمة قد يكون باهظا جدا للقبض على أي بيانات ذات مغزى. You can alter or change the slow query time to lower value or number of seconds. يمكنك تغيير أو تغيير البطيء استفسار الوقت الى انخفاض قيمة او عدد من ثوان. You can set a new long_query_time in the MySQL configuration file, namely my.cnf or my.ini, normally located in /etc directory. يمكنك ان تحدد جديدة long_query_time في ماي. س. ك ملفات ، وهما my.cnf أو my.ini ، تقع عادة في / دليل الخ. Simply add the following line to the configuration file: [...] ببساطة إضافة السطر التالي إلى ملف التكوين : [...]