<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>MySQL Forums - Performance</title>
        <description>Forum for MySQL Performance and Benchmarks.</description>
        <link>http://forums.mysql.com/list.php?24</link>
        <lastBuildDate>Wed, 19 Jun 2013 07:29:18 +0000</lastBuildDate>
        <generator>Phorum 5.2.19</generator>
        <item>
            <guid>http://forums.mysql.com/read.php?24,588640,588640#msg-588640</guid>
            <title>Very slow query (3 replies)</title>
            <link>http://forums.mysql.com/read.php?24,588640,588640#msg-588640</link>
            <description><![CDATA[ Hi, <br />
<br />
I'm trying to optimize my query with index and just having a very hard time.  It really isn't a huge set of data but it has to run often.  Any pointers would be appreciated. <br />
<br />
<pre class="bbcode">
 CREATE TABLE `assessment` (
  `id` varchar(22) COLLATE utf8_unicode_ci NOT NULL,
  `dateCreated` date NOT NULL,
  `dateCompleted` date NOT NULL,
  `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'EX',
  `template` varchar(512) COLLATE utf8_unicode_ci NOT NULL,
  `token` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `d_fk` int(22) unsigned NOT NULL DEFAULT '0',
  `vertical_fk` int(22) unsigned NOT NULL,
  `contact_fk` int(22) unsigned NOT NULL,
  `accountManager_fk` int(22) unsigned NOT NULL,
  `engineer_fk` int(22) unsigned NOT NULL,
  `region_fk` int(22) unsigned NOT NULL,
  `country_fk` int(22) unsigned NOT NULL,
  `status_fk` int(11) unsigned NOT NULL,
  `lastUpdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `product` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'xxx',
  PRIMARY KEY (`id`),
  KEY `dateCreated` (`dateCreated`),
  KEY `cNameLong` (`cNameShort`,`cNameLong`),
  KEY `product` (`product`),
  KEY `dateCompleted` (`dateCompleted`),
  KEY `status` (`status_fk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

*************************** 1. row ***************************
           Name: assessment
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 0
 Avg_row_length: 0
    Data_length: 16384
Max_data_length: 0
   Index_length: 81920
      Data_free: 0
 Auto_increment: NULL
    Create_time: 2013-05-09 14:00:00
    Update_time: NULL
     Check_time: NULL
      Collation: utf8_unicode_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.01 sec)

EXPLAIN EXTENDED SELECT datediff(now(),`dateCreated`) AS 'Created',
       datediff(now(),`dateCompleted`) AS 'Completed',
       a.id AS id,
       product AS 'Product',
       CONCAT(status,'(',status_fk,')') AS 'Status',
       cNameLong AS 'Customer',
       email AS 'Engineer',
       token AS Download,
       (SELECT COUNT(deviceId) FROM T1.chassis c WHERE c.assessmentId = a.id) AS COUNT,
       'files'
FROM assessment a
LEFT OUTER JOIN `chassis` c ON `a`.`id` = `assessmentId`
LEFT OUTER JOIN `status` ON status_fk=`status`.`id`
LEFT OUTER JOIN `engineer` ON engineer_fk=`engineer`.`id`
WHERE status_fk &lt;=
    (SELECT `id`
     FROM status
     WHERE `status`='GENERATED')
GROUP BY `id`\G


*************************** 1. row ***************************
           id: 1
  select_type: PRIMARY
        table: NULL
         type: NULL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: NULL
     filtered: NULL
        Extra: Impossible WHERE noticed after reading const tables
*************************** 2. row ***************************
           id: 3
  select_type: SUBQUERY
        table: NULL
         type: NULL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: NULL
     filtered: NULL
        Extra: no matching row in const table
*************************** 3. row ***************************
           id: 2
  select_type: DEPENDENT SUBQUERY
        table: c
         type: ref
possible_keys: assessmentId2
          key: assessmentId2
      key_len: 62
          ref: func
         rows: 1
     filtered: 100.00
        Extra: Using where; Using index
3 rows in set, 2 warnings (0.00 sec)

SHOW WARNINGS;

mysql&gt; show warnings\G
*************************** 1. row ***************************
  Level: Note
   Code: 1276
Message: Field or reference 'T1.a.id' of SELECT #2 was resolved in SELECT #1
*************************** 2. row ***************************
  Level: Note
   Code: 1003
Message: /* select#1 */ select (to_days(now()) - to_days(`T1`.`a`.`dateCreated`)) AS `Created`,(to_days(now()) - to_days(`T1`.`a`.`dateCompleted`)) AS `Completed`,`T1`.`a`.`id` AS `id`,`T1`.`a`.`product` AS `Product`,concat(`T1`.`status`.`status`,'(',`T1`.`a`.`status_fk`,')') AS `Status`,`T1`.`a`.`cNameLong` AS `Customer`,`T1`.`employee`.`email` AS `Engineer`,`T1`.`a`.`token` AS `Download`,(/* select#2 */ select count(`T1`.`c`.`deviceID`) from `T1`.`chassis` `c` where (`T1`.`c`.`assessmentId` = `T1`.`a`.`id`)) AS `COUNT`,'files' AS `files` from `T1`.`assessment` `a` left join `T1`.`chassis` `c` on((`T1`.`a`.`id` = `T1`.`c`.`assessmentId`)) left join `T1`.`status` on((`T1`.`status`.`id` = `T1`.`a`.`status_fk`)) left join (`T1`.`employee`) on(((`T1`.`a`.`engineer_fk` = `T1`.`employee`.`id`) and (`T1`.`employee`.`role` = _utf8'Engineer'))) where 0 group by `T1`.`a`.`id`
2 rows in set (0.00 sec)
</pre>]]></description>
            <dc:creator>Aram Mirzadeh</dc:creator>
            <category>Performance</category>
            <pubDate>Wed, 19 Jun 2013 02:59:31 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,588419,588419#msg-588419</guid>
            <title>1 row Update query  long for short duration (4 replies)</title>
            <link>http://forums.mysql.com/read.php?24,588419,588419#msg-588419</link>
            <description><![CDATA[ The query below will run less than 1 second all day except for 2 hours at end of day 4pm to 5pm.  Then it takes 2-5 seconds.  <br />
<br />
I run with mysql workbench and all is well.  I did profile on it and result is below.  I run slow query log then all i get is these queries.  They are run in spinoff thread from our app not in the thread atached to a user session.  <br />
<br />
We have 5 different servers all with saame aplications.  This is only server with this behavior. All are 16 core 96GB RAM.  Windows. MySql 5.5.27<br />
<br />
I have trx commit to 0.  I use 8 pools buffer pool size 42GB and thread concurrency to 0<br />
<br />
What else whould i look at beside run show profile when it happens later today? <br />
<br />
<br />
CALL `b0040`.`spMasterTableUpdate`(1096, 2, _binary 'Mr. Rooter Z-Ware License Agreement<br />
<br />
IMPORTANT<br />
<br />
In this Agreement, Mr. Rooter Z-Ware will be referred to as the \&quot;Product.\&quot; <br />
<br />
This software is licensed not sold. Installing this software indicates that the Licensee, has read and understands this license agreement, and accept its terms and conditions. If the Licensee does not agree with this license, the Licensee may not use or install this software or violate any of the terms of this license. Promptly return the software to Mr. Rooter Corporation (\&quot;Mr. Rooter\&quot;).<br />
   <br />
TERMS<br />
<br />
The Licensee may use each licensed copy in the Product on a single computer and make one archival copy of the materials received from Mr. Rooter whole or in part, for backup purposes.<br />
<br />
Except as otherwise expressly permitted in this Agreement, the Licensee may not modify or create any derivative works of the Product or documentation; decompile, disassemble, reverse engineer, or otherwise attempt to derive the source code for the Product  redistribute, sublicense, or otherwise transfer rights to the Product; or remove or alter any trademark, logo, copyright or other proprietary notices in the Product.<br />
<br />
Mr. Rooter reserves the right to disable the Product in part or in whole upon termination of this Agreement.  Mr. Rooter reserves the right to terminate this Agreement if the Licensee breaches any of its terms and conditions, Licensee ceases to be a franchisee or is in breach of his franchise agreement.  Upon termination, the Licensee agrees to destroy the Product together with all archival copies.<br />
<br />
No interest, license, conveyance or any right respecting the Product other than that expressly set out in the Agreement, is granted to Licensee under this Agreement, by implication or otherwise.  The Product is not the property of Licensee, and   Licensee may not sublicense, lease, loan, rent or give the Product or any modification to the Product to any party.  The Product is protected under that section of the franchise agreement addressing Proprietary Information; the Product is accorded the same protection as the manuals, system, other Confidential Information and Trade Secrets (as those terms are defined in your franchise agreement).  The Product is part of the Confidential Information available to franchisees and subject to confidentiality requirements.  Licensee will permit access to the Product only to Licensee s authorized employees and representatives.<br />
<br />
Licensee shall provide protection against computer viruses.<br />
<br />
FEES<br />
<br />
The Licensee shall pay all sales or excise taxes that are assessed against the Product by state, local, or national governments. <br />
<br />
<br />
LIMITED WARRANTY<br />
<br />
Although Mr. Rooter has verified, to the best of its ability, that the Product is reliable, Mr. Rooter does not warrant that the functions contained in the Product will meet the Licensee\'s requirements or that the Product will operate uninterrupted and error-free.<br />
<br />
EXCEPT AS DESCRIBED IN THE LIMITED WARRANTY ABOVE, THE PRODUCT IS PROVIDED ON AN \&quot;AS IS\&quot; BASIS, WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT LIMITATION THE WARRANTIES THAT IT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING AND ALL SUCH WARRANTIES ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED.  SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT APPLY.  THIS WARRANTY GIVES THE LICENSEE SPECIFIC LEGAL RIGHTS AND THE LICENSEE MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE.<br />
<br />
THE SECURITY MECHANISMS IMPLEMENTED BY THE PRODUCT HAVE INHERENT LIMITATIONS, AND LICENSEE MUST DETERMINE THAT THE PRODUCT SUFFICIENTLY MEETS ITS REQUIREMENTS. THE LICENSEE MUST SECURE ALL MEDIA DISTRIBUTED TO THEM BY MR. ROOTER AS WELL AS THE COMPUTER EQUIPMENT ON WHICH THIS PRODUCT IS INSTALLED AND DESTROY OR RETURN ALL SUCH MEDIA UPON TERMINATION OF THIS AGREEMENT. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS AGREEMENT.  NO USE OF THE PRODUCT IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.  <br />
 <br />
<br />
LIMITATION OF LIABILITY<br />
<br />
IN NO EVENT WILL MR. ROOTER ITS SUPPLIERS OR RESELLERS OR ANY CONTRIBUTORS TO THE SOURCE CODE BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, MR. ROOTER\'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS AGREEMENT SHALL NOT EXCEED IN THE AGGREGATE THE SUM OF THE FEES LICENSEE PAID FOR THIS LICENSE AND FEES INCURRED FOR THE MAINTANANCE OF THE PRODUCT EXCEPT TO THE EXTENT APPLICABLE LAW PROHIBITS THE LIMITATION OF DAMAGES.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT BE APPLICABLE.  <br />
<br />
EXPORT CONTROL<br />
<br />
The Product includes strong encryption.  Licensee agrees to comply with all export laws and restrictions and regulations of the United States or foreign agencies or authorities, and not to export or re-export the Product or any direct product thereof in violation of any such restrictions, laws or regulations, or without all necessary approvals.  As applicable, each party shall obtain and bear all expenses relating to any necessary licenses and/or exemptions with respect to its own export of the Product from the U.S.  Neither the Product nor the underlying information or technology may be downloaded or otherwise exported or re-exported into Cuba, Iran, Iraq, Libya, North Korea, Sudan, Syria or any other country subject to U.S. trade sanctions covering the Product, to individuals or entities controlled by such countries, or to nationals or residents of such countries other than nationals who are lawfully admitted permanent residents of countries not subject to such sanctions; or to anyone on the U.S. Treasury Department\'s list of Specially Designated Nationals and Blocked Persons or the U.S. Commerce Department\'s Table of Denial Orders.  By installing or using the Product, the Licensee agrees to the foregoing and represents and warrants that it complies with these conditions.<br />
<br />
MISCELLANEOUS<br />
<br />
This Agreement constitutes the entire agreement between the parties, and supersedes all prior agreements, whether written or oral. The terms of this Agreement may be modified by Mr. Rooter upon written notice to Licensee.<br />
<br />
<br />
1)  MasterPassword - Allows you access to any area.  To use enter the MasterPassword above and then you can enter the same Password in any field that requests one.<br />
<br />
2)  SetupPassword - Allows you access to Prospect Setup.  We recommend using this setting in a multi-user environment.  To use, enter the SetupPassword above and then as you enter the Prospect Setup area you will be prompted to enter that password.<br />
<br />
3)  UsePasswords is available to assign specific passwords to your employees.  To use, select the UsePasswords option above and then close this window.  Then select Employees.  Add each Employee Name as they will enter it on the system and their individual Password.  When starting the system, employees will be prompted to select their name and enter a password.',<br />
<br />
IMPORTANT<br />
<br />
In this Agreement, Mr. Rooter Z-Ware will be referred to as the \&quot;Product.\&quot; <br />
<br />
This software is licensed not sold. Installing this software indicates that the Licensee, has read and understands this license agreement, and accept its terms and conditions. If the Licensee does not agree with this license, the Licensee may not use or install this software or violate any of the terms of this license. Promptly return the software to Mr. Rooter Corporation (\&quot;Mr. Rooter\&quot;).<br />
   <br />
TERMS<br />
<br />
The Licensee may use each licensed copy in the Product on a single computer and make one archival copy of the materials received from Mr. Rooter whole or in part, for backup purposes.<br />
<br />
Except as otherwise expressly permitted in this Agreement, the Licensee may not modify or create any derivative works of the Product or documentation; decompile, disassemble, reverse engineer, or otherwise attempt to derive the source code for the Product  redistribute, sublicense, or otherwise transfer rights to the Product; or remove or alter any trademark, logo, copyright or other proprietary notices in the Product.<br />
<br />
Mr. Rooter reserves the right to disable the Product in part or in whole upon termination of this Agreement.  Mr. Rooter reserves the right to terminate this Agreement if the Licensee breaches any of its terms and conditions, Licensee ceases to be a franchisee or is in breach of his franchise agreement.  Upon termination, the Licensee agrees to destroy the Product together with all archival copies.<br />
<br />
No interest, license, conveyance or any right respecting the Product other than that expressly set out in the Agreement, is granted to Licensee under this Agreement, by implication or otherwise.  The Product is not the property of Licensee, and   Licensee may not sublicense, lease, loan, rent or give the Product or any modification to the Product to any party.  The Product is protected under that section of the franchise agreement addressing Proprietary Information; the Product is accorded the same protection as the manuals, system, other Confidential Information and Trade Secrets (as those terms are defined in your franchise agreement).  The Product is part of the Confidential Information available to franchisees and subject to confidentiality requirements.  Licensee will permit access to the Product only to Licensee s authorized employees and representatives.<br />
<br />
Licensee shall provide protection against computer viruses.<br />
<br />
FEES<br />
<br />
The Licensee shall pay all sales or excise taxes that are assessed against the Product by state, local, or national governments. <br />
<br />
<br />
LIMITED WARRANTY<br />
<br />
Although Mr. Rooter has verified, to the best of its ability, that the Product is reliable, Mr. Rooter does not warrant that the functions contained in the Product will meet the Licensee\'s requirements or that the Product will operate uninterrupted and error-free.<br />
<br />
EXCEPT AS DESCRIBED IN THE LIMITED WARRANTY ABOVE, THE PRODUCT IS PROVIDED ON AN \&quot;AS IS\&quot; BASIS, WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT LIMITATION THE WARRANTIES THAT IT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING AND ALL SUCH WARRANTIES ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED.  SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT APPLY.  THIS WARRANTY GIVES THE LICENSEE SPECIFIC LEGAL RIGHTS AND THE LICENSEE MAY ALSO HAVE OTHER RIGHTS WHICH VARY FROM STATE TO STATE.<br />
<br />
THE SECURITY MECHANISMS IMPLEMENTED BY THE PRODUCT HAVE INHERENT LIMITATIONS, AND LICENSEE MUST DETERMINE THAT THE PRODUCT SUFFICIENTLY MEETS ITS REQUIREMENTS. THE LICENSEE MUST SECURE ALL MEDIA DISTRIBUTED TO THEM BY MR. ROOTER AS WELL AS THE COMPUTER EQUIPMENT ON WHICH THIS PRODUCT IS INSTALLED AND DESTROY OR RETURN ALL SUCH MEDIA UPON TERMINATION OF THIS AGREEMENT. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS AGREEMENT.  NO USE OF THE PRODUCT IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.  <br />
 <br />
<br />
LIMITATION OF LIABILITY<br />
<br />
IN NO EVENT WILL MR. ROOTER ITS SUPPLIERS OR RESELLERS OR ANY CONTRIBUTORS TO THE SOURCE CODE BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, MR. ROOTER\'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS AGREEMENT SHALL NOT EXCEED IN THE AGGREGATE THE SUM OF THE FEES LICENSEE PAID FOR THIS LICENSE AND FEES INCURRED FOR THE MAINTANANCE OF THE PRODUCT EXCEPT TO THE EXTENT APPLICABLE LAW PROHIBITS THE LIMITATION OF DAMAGES.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT BE APPLICABLE.  <br />
<br />
EXPORT CONTROL<br />
<br />
The Product includes strong encryption.  Licensee agrees to comply with all export laws and restrictions and regulations of the United States or foreign agencies or authorities, and not to export or re-export the Product or any direct product thereof in violation of any such restrictions, laws or regulations, or without all necessary approvals.  As applicable, each party shall obtain and bear all expenses relating to any necessary licenses and/or exemptions with respect to its own export of the Product from the U.S.  Neither the Product nor the underlying information or technology may be downloaded or otherwise exported or re-exported into Cuba, Iran, Iraq, Libya, North Korea, Sudan, Syria or any other country subject to U.S. trade sanctions covering the Product, to individuals or entities controlled by such countries, or to nationals or residents of such countries other than nationals who are lawfully admitted permanent residents of countries not subject to such sanctions; or to anyone on the U.S. Treasury Department\'s list of Specially Designated Nationals and Blocked Persons or the U.S. Commerce Department\'s Table of Denial Orders.  By installing or using the Product, the Licensee agrees to the foregoing and represents and warrants that it complies with these conditions.<br />
<br />
MISCELLANEOUS<br />
<br />
This Agreement constitutes the entire agreement between the parties, and supersedes all prior agreements, whether written or oral. The terms of this Agreement may be modified by Mr. Rooter upon written notice to Licensee.<br />
<br />
1)  MasterPassword - Allows you access to any area.  To use enter the MasterPassword above and then you can enter the same Password in any field that requests one.<br />
<br />
2)  SetupPassword - Allows you access to Prospect Setup.  We recommend using this setting in a multi-user environment.  To use, enter the SetupPassword above and then as you enter the Prospect Setup area you will be prompted to enter that password.,NULL,NULL);<br />
<br />
 <br />
<br />
'continuing inside routine', '0.195179'<br />
'checking permissions', '0.000082'<br />
'Opening tables', '0.000026'<br />
'System lock', '0.000018'<br />
'init', '0.000785'<br />
'Updating', '0.000129'<br />
'end', '0.000022'<br />
'query end', '0.000020'<br />
'closing tables', '0.000687']]></description>
            <dc:creator>karl lauritzen</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 15 Jun 2013 05:17:00 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,588086,588086#msg-588086</guid>
            <title>how  mysqlslap support utf8   encoding (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,588086,588086#msg-588086</link>
            <description><![CDATA[ I create create.sql and query.sql  file used for mysqlslap<br />
just like <br />
# mysqlslap -uroot -proot --create=&quot;create.sql&quot; --query=&quot;query.sql&quot; --concurrency=100  --number-of-queries=1000  <br />
<br />
When file's encoding use ANSI,it's working well.<br />
Bug when the files's encoding use utf8 ,an error occur.<br />
<br />
and both ANSI and Utf8, the mysql client program working well.<br />
#mysql -uroot -proot &lt;query.sql<br />
<br />
Do mysqlslap can't support utf8 encoding files?]]></description>
            <dc:creator>Edward Tsang</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 08 Jun 2013 12:03:55 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,587801,587801#msg-587801</guid>
            <title>Static, 120GB, InnoDB table is unusuable (4 replies)</title>
            <link>http://forums.mysql.com/read.php?24,587801,587801#msg-587801</link>
            <description><![CDATA[ I've inherited a MySQL 5.5.16 x64 server running OpenSUSE 12.1 on an Intel Xeon E5520 with 74 GB RAM. <br />
<br />
The main table uses the InnoDB engine and has 10 fields, all 16- or 32-bit integers.  There are 1.67 billion rows (~120GB).  It is a static table.<br />
<br />
Running simple queries or altering the table (e.g. adding an index) times out eventually and is unable to fulfill the request.  Even running COUNT(*) takes 15 - 30 minutes.<br />
<br />
As a workaround, I've been writing .NET client applications to slide through the table using the primary ID in groups of 1,000,000 rows.  That takes 7 - 8 hours though just to complete once the code is written and tested.<br />
<br />
Any advice on what to check for to help improve it would be greatly appreciated.<br />
<br />
SHOW VARIABLES:<br />
<br />
Variable_name  | Value<br />
auto_increment_increment   |  1<br />
auto_increment_offset  | 1<br />
autocommit   |  ON<br />
automatic_sp_privileges  | ON<br />
back_log   |  50<br />
basedir  | /usr<br />
big_tables   |  OFF<br />
binlog_cache_size  | 4096<br />
binlog_direct_non_transactional_updates  | OFF<br />
binlog_format  | STATEMENT<br />
binlog_stmt_cache_size   |  32768<br />
bulk_insert_buffer_size  | 8388608<br />
character_set_client   |  utf8<br />
character_set_connection   |  utf8<br />
character_set_database   |  utf8<br />
character_set_filesystem   |  binary<br />
character_set_results  | utf8<br />
character_set_server   |  utf8<br />
character_set_system   |  utf8<br />
character_sets_dir   |  /usr/share/mysql/charsets/<br />
collation_connection   |  utf8_general_ci<br />
collation_database   |  utf8_general_ci<br />
collation_server   |  utf8_general_ci<br />
completion_type  | NO_CHAIN<br />
concurrent_insert  | AUTO<br />
connect_timeout  | 60<br />
datadir  | /home/mysqladmin/mysql/<br />
date_format  | %Y-%m-%d<br />
datetime_format  | %Y-%m-%d %H:%i:%s<br />
default_storage_engine   |  InnoDB<br />
default_week_format  | 0<br />
delay_key_write  | ON<br />
delayed_insert_limit   |  100<br />
delayed_insert_timeout   |  300<br />
delayed_queue_size   |  1000<br />
div_precision_increment  | 4<br />
engine_condition_pushdown  | ON<br />
error_count  | 0<br />
event_scheduler  | OFF<br />
expire_logs_days   |  0<br />
external_user  | <br />
flush  | OFF<br />
flush_time   |  0<br />
foreign_key_checks   |  ON<br />
ft_boolean_syntax  | + -&gt;&lt;()~*:&quot;&quot;&amp;|<br />
ft_max_word_len  | 84<br />
ft_min_word_len  | 4<br />
ft_query_expansion_limit   |  20<br />
ft_stopword_file   |  (built-in)<br />
general_log  | ON<br />
general_log_file   |  /home/mysqladmin/mysql/mysql1.log<br />
group_concat_max_len   |  1024<br />
have_compress  | YES<br />
have_crypt   |  YES<br />
have_csv   |  YES<br />
have_dynamic_loading   |  YES<br />
have_geometry  | YES<br />
have_innodb  | YES<br />
have_ndbcluster  | NO<br />
have_openssl   |  DISABLED<br />
have_partitioning  | YES<br />
have_profiling   |  YES<br />
have_query_cache   |  YES<br />
have_rtree_keys  | YES<br />
have_ssl   |  DISABLED<br />
have_symlink   |  YES<br />
hostname   |  mysql1<br />
identity   |  0<br />
ignore_builtin_innodb  | OFF<br />
init_connect   |  <br />
init_file  | <br />
init_slave   |  <br />
innodb_adaptive_flushing   |  ON<br />
innodb_adaptive_hash_index   |  ON<br />
innodb_additional_mem_pool_size  | 8388608<br />
innodb_autoextend_increment  | 8<br />
innodb_autoinc_lock_mode   |  1<br />
innodb_buffer_pool_instances   |  1<br />
innodb_buffer_pool_size  | 134217728<br />
innodb_change_buffering  | all<br />
innodb_checksums   |  ON<br />
innodb_commit_concurrency  | 0<br />
innodb_concurrency_tickets   |  500<br />
innodb_data_file_path  | ibdata1:10M:autoextend<br />
innodb_data_home_dir   |  /home/mysqladmin/mysql/innodb<br />
innodb_doublewrite   |  ON<br />
innodb_fast_shutdown   |  1<br />
innodb_file_format   |  Antelope<br />
innodb_file_format_check   |  ON<br />
innodb_file_format_max   |  Antelope<br />
innodb_file_per_table  | OFF<br />
innodb_flush_log_at_trx_commit   |  1<br />
innodb_flush_method  | <br />
innodb_force_recovery  | 0<br />
innodb_io_capacity   |  200<br />
innodb_large_prefix  | OFF<br />
innodb_lock_wait_timeout   |  50<br />
innodb_locks_unsafe_for_binlog   |  OFF<br />
innodb_log_buffer_size   |  8388608<br />
innodb_log_file_size   |  5242880<br />
innodb_log_files_in_group  | 2<br />
innodb_log_group_home_dir  | /home/mysqladmin/mysql/innodb<br />
innodb_max_dirty_pages_pct   |  75<br />
innodb_max_purge_lag   |  0<br />
innodb_mirrored_log_groups   |  1<br />
innodb_old_blocks_pct  | 37<br />
innodb_old_blocks_time   |  0<br />
innodb_open_files  | 300<br />
innodb_purge_batch_size  | 20<br />
innodb_purge_threads   |  0<br />
innodb_random_read_ahead   |  OFF<br />
innodb_read_ahead_threshold  | 56<br />
innodb_read_io_threads   |  4<br />
innodb_replication_delay   |  0<br />
innodb_rollback_on_timeout   |  OFF<br />
innodb_rollback_segments   |  128<br />
innodb_spin_wait_delay   |  6<br />
innodb_stats_method  | nulls_equal<br />
innodb_stats_on_metadata   |  ON<br />
innodb_stats_sample_pages  | 8<br />
innodb_strict_mode   |  OFF<br />
innodb_support_xa  | ON<br />
innodb_sync_spin_loops   |  30<br />
innodb_table_locks   |  ON<br />
innodb_thread_concurrency  | 0<br />
innodb_thread_sleep_delay  | 10000<br />
innodb_use_native_aio  | OFF<br />
innodb_use_sys_malloc  | ON<br />
innodb_version   |  1.1.8<br />
innodb_write_io_threads  | 4<br />
insert_id  | 0<br />
interactive_timeout  | 28800<br />
join_buffer_size   |  131072<br />
keep_files_on_create   |  OFF<br />
key_buffer_size  | 17179869184<br />
key_cache_age_threshold  | 300<br />
key_cache_block_size   |  1024<br />
key_cache_division_limit   |  100<br />
large_files_support  | ON<br />
large_page_size  | 0<br />
large_pages  | OFF<br />
last_insert_id   |  0<br />
lc_messages  | en_US<br />
lc_messages_dir  | /usr/share/mysql/<br />
lc_time_names  | en_US<br />
license  | GPL<br />
local_infile   |  ON<br />
lock_wait_timeout  | 31536000<br />
locked_in_memory   |  OFF<br />
log  | ON<br />
log_bin  | OFF<br />
log_bin_trust_function_creators  | OFF<br />
log_error  | /home/mysqladmin/mysql/mysqld.log<br />
log_output   |  FILE<br />
log_queries_not_using_indexes  | OFF<br />
log_slave_updates  | OFF<br />
log_slow_queries   |  OFF<br />
log_warnings   |  1<br />
long_query_time  | 10<br />
low_priority_updates   |  OFF<br />
lower_case_file_system   |  OFF<br />
lower_case_table_names   |  0<br />
max_allowed_packet   |  134217728<br />
max_binlog_cache_size  | 18446744073709551615<br />
max_binlog_size  | 1073741824<br />
max_binlog_stmt_cache_size   |  18446744073709551615<br />
max_connect_errors   |  1000<br />
max_connections  | 151<br />
max_delayed_threads  | 20<br />
max_error_count  | 64<br />
max_heap_table_size  | 16777216<br />
max_insert_delayed_threads   |  20<br />
max_join_size  | 18446744073709551615<br />
max_length_for_sort_data   |  1024<br />
max_long_data_size   |  134217728<br />
max_prepared_stmt_count  | 16382<br />
max_relay_log_size   |  0<br />
max_seeks_for_key  | 18446744073709551615<br />
max_sort_length  | 1024<br />
max_sp_recursion_depth   |  0<br />
max_tmp_tables   |  32<br />
max_user_connections   |  0<br />
max_write_lock_count   |  18446744073709551615<br />
min_examined_row_limit   |  0<br />
multi_range_count  | 256<br />
myisam_data_pointer_size   |  6<br />
myisam_max_sort_file_size  | 9223372036853727232<br />
myisam_mmap_size   |  18446744073709551615<br />
myisam_recover_options   |  OFF<br />
myisam_repair_threads  | 1<br />
myisam_sort_buffer_size  | 8589934592<br />
myisam_stats_method  | nulls_unequal<br />
myisam_use_mmap  | OFF<br />
net_buffer_length  | 16384<br />
net_read_timeout   |  30<br />
net_retry_count  | 10<br />
net_write_timeout  | 60<br />
new  | OFF<br />
old  | OFF<br />
old_alter_table  | OFF<br />
old_passwords  | OFF<br />
open_files_limit   |  1185<br />
optimizer_prune_level  | 1<br />
optimizer_search_depth   |  62<br />
optimizer_switch   |  index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on<br />
performance_schema   |  OFF<br />
performance_schema_events_waits_history_long_size  | 10000<br />
performance_schema_events_waits_history_size   |  10<br />
performance_schema_max_cond_classes  | 80<br />
performance_schema_max_cond_instances  | 1000<br />
performance_schema_max_file_classes  | 50<br />
performance_schema_max_file_handles  | 32768<br />
performance_schema_max_file_instances  | 10000<br />
performance_schema_max_mutex_classes   |  200<br />
performance_schema_max_mutex_instances   |  1000000<br />
performance_schema_max_rwlock_classes  | 30<br />
performance_schema_max_rwlock_instances  | 1000000<br />
performance_schema_max_table_handles   |  100000<br />
performance_schema_max_table_instances   |  50000<br />
performance_schema_max_thread_classes  | 50<br />
performance_schema_max_thread_instances  | 1000<br />
pid_file   |  /var/run/mysql/mysqld.pid<br />
plugin_dir   |  /usr/lib64/mysql/plugin<br />
port   |  3306<br />
preload_buffer_size  | 32768<br />
profiling  | OFF<br />
profiling_history_size   |  15<br />
protocol_version   |  10<br />
proxy_user   |  <br />
pseudo_thread_id   |  167<br />
query_alloc_block_size   |  8192<br />
query_cache_limit  | 1048576<br />
query_cache_min_res_unit   |  4096<br />
query_cache_size   |  4294967296<br />
query_cache_type   |  ON<br />
query_cache_wlock_invalidate   |  OFF<br />
query_prealloc_size  | 8192<br />
rand_seed1   |  0<br />
rand_seed2   |  0<br />
range_alloc_block_size   |  4096<br />
read_buffer_size   |  8388608<br />
read_only  | OFF<br />
read_rnd_buffer_size   |  25165824<br />
relay_log  | <br />
relay_log_index  | <br />
relay_log_info_file  | relay-log.info<br />
relay_log_purge  | ON<br />
relay_log_recovery   |  OFF<br />
relay_log_space_limit  | 0<br />
report_host  | <br />
report_password  | <br />
report_port  | 3306<br />
report_user  | <br />
rpl_recovery_rank  | 0<br />
secure_auth  | OFF<br />
secure_file_priv   |  <br />
server_id  | 1<br />
skip_external_locking  | ON<br />
skip_name_resolve  | OFF<br />
skip_networking  | OFF<br />
skip_show_database   |  OFF<br />
slave_compressed_protocol  | OFF<br />
slave_exec_mode  | STRICT<br />
slave_load_tmpdir  | /home/mysqladmin/mysql/tmp<br />
slave_net_timeout  | 3600<br />
slave_skip_errors  | OFF<br />
slave_transaction_retries  | 10<br />
slave_type_conversions   |  <br />
slow_launch_time   |  2<br />
slow_query_log   |  OFF<br />
slow_query_log_file  | /home/mysqladmin/mysql/mysql1-slow.log<br />
socket   |  /var/run/mysql/mysql.sock<br />
sort_buffer_size   |  1073741824<br />
sql_auto_is_null   |  OFF<br />
sql_big_selects  | ON<br />
sql_big_tables   |  OFF<br />
sql_buffer_result  | OFF<br />
sql_log_bin  | ON<br />
sql_log_off  | OFF<br />
sql_low_priority_updates   |  OFF<br />
sql_max_join_size  | 18446744073709551615<br />
sql_mode   |  <br />
sql_notes  | ON<br />
sql_quote_show_create  | ON<br />
sql_safe_updates   |  OFF<br />
sql_select_limit   |  18446744073709551615<br />
sql_slave_skip_counter   |  0<br />
sql_warnings   |  OFF<br />
ssl_ca   |  <br />
ssl_capath   |  <br />
ssl_cert   |  <br />
ssl_cipher   |  <br />
ssl_key  | <br />
storage_engine   |  InnoDB<br />
sync_binlog  | 0<br />
sync_frm   |  ON<br />
sync_master_info   |  0<br />
sync_relay_log   |  0<br />
sync_relay_log_info  | 0<br />
system_time_zone   |  EDT<br />
table_definition_cache   |  400<br />
table_open_cache   |  512<br />
thread_cache_size  | 20<br />
thread_concurrency   |  16<br />
thread_handling  | one-thread-per-connection<br />
thread_stack   |  262144<br />
time_format  | %H:%i:%s<br />
time_zone  | SYSTEM<br />
timed_mutexes  | OFF<br />
timestamp  | 1370103352<br />
tmp_table_size   |  55834574848<br />
tmpdir   |  /home/mysqladmin/mysql/tmp<br />
transaction_alloc_block_size   |  8192<br />
transaction_prealloc_size  | 4096<br />
tx_isolation   |  REPEATABLE-READ<br />
unique_checks  | ON<br />
updatable_views_with_limit   |  YES<br />
version  | 5.5.16-log<br />
version_comment  | Source distribution<br />
version_compile_machine  | x86_64<br />
version_compile_os   |  Linux<br />
wait_timeout   |  28800<br />
warning_count  | 0]]></description>
            <dc:creator>Nicholas Hans</dc:creator>
            <category>Performance</category>
            <pubDate>Mon, 03 Jun 2013 02:33:00 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,587649,587649#msg-587649</guid>
            <title>Question on slow queries (6 replies)</title>
            <link>http://forums.mysql.com/read.php?24,587649,587649#msg-587649</link>
            <description><![CDATA[ Hello, I ran a tool on my website and i got these ranking of slow queries. The db engine is INNODB, and i see that the COMMIT and some UPDATES is @ first position. How can i fix this problem? Below i have pasted my my.cnf. May thanks.<br />
<br />
# 838.2s user time, 2.2s system time, 113.31M rss, 199.30M vsz<br />
# Current date: Thu May 30 10:09:18 2013<br />
# Hostname: ***<br />
# Files: /var/lib/mysql/mysql-slow.log<br />
# Overall: 3.25M total, 1.11k unique, 64.27 QPS, 0.18x concurrency _______<br />
# Time range: 2013-05-29 19:51:01 to 2013-05-30 09:53:35<br />
# Attribute          total     min     max     avg     95%  stddev  median<br />
# ============     ======= ======= ======= ======= ======= ======= =======<br />
# Exec time          8915s     1us     24s     3ms     1ms    70ms    27us<br />
# Lock time           343s       0      5s   105us   260us     5ms       0<br />
# Rows sent         17.53M       0 151.08k    5.66   19.46  129.22       0<br />
# Rows examine     245.73M       0 151.08k   79.31   28.75   1.47k       0<br />
# Query size       242.82M       5  55.10k   78.28  183.58  101.50   36.69<br />
<br />
# Profile<br />
# Rank Query ID           Response time   Calls   R/Call Apdx V/M   Item<br />
# ==== ================== =============== ======= ====== ==== ===== ======<br />
#    1 0x813031B8BBC3B329  944.3823 10.6%   14740 0.0641 0.99  1.47 COMMIT<br />
#    2 0x2946F5C805C641F0  731.4449  8.2%    4398 0.1663 0.98  1.80 UPDATE character_stats<br />
#    3 0x06BA864C75EF674B  526.1830  5.9%    1452 0.3624 0.96  1.33 UPDATE users<br />
#    4 0xDD330E911DAEA564  462.8022  5.2%    2205 0.2099 0.98  1.16 UPDATE characters<br />
#    5 0xBD6E40FB34D33F35  407.3738  4.6%    4344 0.0938 0.99  1.47 UPDATE items<br />
#    6 0x401B579DF69F42EC  369.0405  4.1%  240553 0.0015 1.00  1.94 SELECT characters<br />
#    7 0x594F579F62DEA5CF  367.6932  4.1%    1264 0.2909 0.96  1.75 INSERT stats_globals<br />
#    8 0x02744255916D5340  349.9996  3.9%  144223 0.0024 1.00  1.63 SELECT users<br />
#    9 0x1A0E0318A9EB259C  273.7407  3.1%  124777 0.0022 1.00  0.26 SHOW COLUMNS<br />
#   10 0xA35332B856A53F6B  199.9855  2.2%  111913 0.0018 1.00  0.19 SHOW COLUMNS<br />
#   11 0x75B1DBD48BF47623  199.0869  2.2%     129 1.5433 0.74  4.24 INSERT stats_globals<br />
#   12 0x582611CFF1C063BB  183.3514  2.1%     649 0.2825 0.98  0.85 UPDATE characters<br />
#   13 0xDF1FB1A2536CEFBE  173.0813  1.9%     619 0.2796 0.97  0.81 UPDATE messages<br />
#   14 0x754B29BDA72EF43B  168.5860  1.9%     627 0.2689 0.97  0.89 INSERT toplistvotes<br />
#   15 0xE5C6D63541E4E1E2  164.9002  1.8%    1452 0.1136 0.99  1.38 INSERT trace_user_logins<br />
#   16 0x0D2F027A30BDA707  163.3852  1.8%     626 0.2610 0.98  0.79 INSERT messages<br />
#   17 0x076B778757C29A1E  140.1671  1.6%     358 0.3915 0.96  3.75 UPDATE items<br />
#   18 0x8F02E08F358A68AC  119.7538  1.3%    1562 0.0767 1.00  0.51 UPDATE character_actions<br />
#   19 0xC13C4066C2C95AF5  117.0228  1.3%    1562 0.0749 1.00  3.15 SELECT character_actions<br />
#   20 0xB5F7525A5CB371E9  105.5070  1.2%     395 0.2671 0.97  1.63 INSERT character_actions<br />
#   21 0x79136FFAD369F1BA  105.3963  1.2%     354 0.2977 0.97  1.26 INSERT character_actions<br />
#   34 0x7B5B7941028EDE4B   54.0050  0.6%      55 0.9819 0.88  4.13 UPDATE ads<br />
#   57 0x9E7261B3F59F331E   19.2066  0.2%      58 0.3311 0.95  0.67 INSERT character_actions<br />
#   64 0x67A347A2812914DF   16.0391  0.2%      25 0.6416 0.88  3.22 SELECT messages_archive<br />
#   69 0x57A18166A52BD016   14.5479  0.2%      55 0.2645 0.95  4.60 SELECT ad_extras<br />
#   71 0xD350A58013580CAE   14.5026  0.2%      52 0.2789 0.96  0.49 INSERT character_actions<br />
#   73 0xABCD223742501FB1   13.8047  0.2%      22 0.6275 0.89  1.54 UPDATE users<br />
#   83 0xFBB53CDC0C3D2272   10.6655  0.1%      31 0.3440 0.94  0.94 INSERT items<br />
#   98 0x2857E030AF6C119B    8.0144  0.1%      13 0.6165 0.88  1.84 INSERT group_characters<br />
#  107 0x4C61C246A8EE9F3C    6.0430  0.1%      12 0.5036 0.92  0.85 INSERT character_actions<br />
# MISC 0xMISC             2485.5319 27.9% 2590372 0.0010   NS   0.0 &lt;1074 ITEMS&gt;<br />
<br />
my.cnf<br />
<br />
[mysqlhotcopy]<br />
interactive-timeout<br />
<br />
[mysqld]<br />
key_buffer=64M<br />
thread_concurrency=8<br />
max_connections=40<br />
max_user_connections=40<br />
<br />
#long_query_time=0<br />
#log_slow_queries=&quot;/var/lib/mysql/mysql-slow.log&quot;<br />
<br />
read_buffer_size=2M<br />
table_cache=750<br />
tmp_table_size=256M<br />
<br />
# InnoDB<br />
# Set buffer pool size to 50-80% of your computer's memory<br />
innodb_buffer_pool_size=640M<br />
innodb_additional_mem_pool_size=20M<br />
# Set the log file size to about 25% of the buffer pool size<br />
innodb_log_file_size=128M<br />
innodb_log_buffer_size=8M<br />
innodb_file_per_table=1<br />
innodb_thread_concurrency=2<br />
<br />
wait_timeout=40<br />
skip-external-locking<br />
myisam_sort_buffer_size=64M<br />
connect_timeout=10<br />
max_allowed_packet=1M<br />
server-id=1<br />
thread_cache_size=8<br />
sort_buffer_size=2M<br />
read_rnd_buffer_size=8M<br />
query_cache_size=56M<br />
<br />
open_files_limit=2966<br />
[myisamchk]<br />
key_buffer=64M<br />
sort_buffer_size=64M<br />
write_buffer=2M<br />
read_buffer=2M<br />
<br />
[mysqldump]<br />
quick<br />
max_allowed_packet=16M<br />
[mysql]<br />
no-auto-rehash]]></description>
            <dc:creator>Michele Quaini</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 06 Jun 2013 08:02:35 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,587648,587648#msg-587648</guid>
            <title>Slow performance over network (no replies)</title>
            <link>http://forums.mysql.com/read.php?24,587648,587648#msg-587648</link>
            <description><![CDATA[ Overview<br />
Tomcat application version: 5.5.20 with server IBM x3550 M2 with 8GB RAM Xeon X5570 2.93GHz running SLES 11 SP0<br />
MySQL 5.1 on IBM x3650 M2 96GB RAM Xeon X5570 2.93GHz running SLES 11 SP0<br />
<br />
Migrated for hardware upgrades for MySQL servers  and virtualizing the application servers:<br />
Tomcat application same versions VM 8GB RAM 8xvCPU Xeon 2.6GHz running SLES 11 SP2<br />
MySQL physical servers IBM x3650 192 GB RAM 2x8Core Xeon E5-2670 2.6GHz running SLES 11 SP2<br />
Both backed by SAN storage (IBM v7000) with 8GB fibre<br />
<br />
Challenge:<br />
The new server estate running significantly slower than the original setup – ‘bad performance’, mostly slow connect times - 40-400 ms (instead of less than 1 ms)<br />
<br />
Tried so far:<br />
Multiple MySQL and OS configuration parameters (support calls open with Oracle and Novell) <br />
We have tried rolling back the OSs to SLES SP0 and SP1 to no effect<br />
Virtualizing MySQL<br />
Running MySQL on similarly ‘old’ M2 class hardware<br />
<br />
A test we ran which had ‘good performance’ was when we put the application on the MySQL server and using ‘localhost’ in the connection strings (to bypass networking)<br />
<br />
current params set to cut out the DNS are:<br />
skip-name-resolve<br />
skip-host-cache<br />
<br />
<br />
any ideas much appreciated, i appreciate the versions of mysql and tomcat etc are old - but thats the app unfortunately!]]></description>
            <dc:creator>Will Duckworth</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 30 May 2013 09:45:36 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,587170,587170#msg-587170</guid>
            <title>The mysql vs mysqli db driver for a php app - any clear cut winner? (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,587170,587170#msg-587170</link>
            <description><![CDATA[ Any benefit from switching the db driver from mysql to mysqli on a php app? I've been searching around and I see arguments for both from a performance perspective. Is there a typical clear cut winner?]]></description>
            <dc:creator>Thomas Kazarian</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 25 May 2013 21:55:32 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,586900,586900#msg-586900</guid>
            <title>MySQL 5.6:  Detailed Profiling of SQL Activity (no replies)</title>
            <link>http://forums.mysql.com/read.php?24,586900,586900#msg-586900</link>
            <description><![CDATA[ MySQL 5.6:  Detailed Profiling of SQL Activity<br />
<a href="http://www.drdobbs.com/database/detailed-profiling-of-sql-activity-in-my/240154959?pgno=1"  rel="nofollow">http://www.drdobbs.com/database/detailed-profiling-of-sql-activity-in-my/240154959?pgno=1</a>]]></description>
            <dc:creator>Edwin Desouza</dc:creator>
            <category>Performance</category>
            <pubDate>Mon, 20 May 2013 16:02:30 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,586309,586309#msg-586309</guid>
            <title>High CPU usage in %user (3 replies)</title>
            <link>http://forums.mysql.com/read.php?24,586309,586309#msg-586309</link>
            <description><![CDATA[ Hello,<br />
<br />
Recently I got a new server and I have migrated everything from old to new (LAMP).<br />
Without any modification, mysql have started to usage too much CPU and the queries are very slow.<br />
<br />
The more strange thing it is that the CPU usage is for the %user and it is always about 30%:<br />
<br />
<pre class="bbcode">
# sar 2 5
Linux 2.6.32-5-amd64 (hostname) 	05/14/2013 	_x86_64_	(24 CPU)

08:11:59 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
08:13:07 PM     all     33.11      0.00      0.77      0.00      0.00     66.12
08:13:09 PM     all     32.71      0.00      0.73      0.02      0.00     66.54
08:13:11 PM     all     34.51      0.00      0.63      0.00      0.00     64.86
08:13:13 PM     all     33.39      0.00      0.42      0.04      0.00     66.15
08:13:15 PM     all     33.29      0.00      0.44      0.00      0.00     66.26
Average:        all     33.39      0.00      0.60      0.01      0.00     66.00</pre>
<br />
I don't have memory problem, because the disk is not used (as you can see iowait is in 0%).<br />
<br />
The only process is usaging the cpu is mysql:<br />
<pre class="bbcode">
Tasks: 424 total,   1 running, 422 sleeping,   0 stopped,   1 zombie
Cpu(s): 27.3%us,  0.4%sy,  0.0%ni, 72.3%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  32979568k total, 27494980k used,  5484588k free,   932472k buffers
Swap:  7999992k total,     6792k used,  7993200k free, 19934596k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                  
31390 mysql     20   0 5542m 5.0g 7976 S  708 15.9   1833:52 mysqld                                                                                   
28063 www-data  20   0  261m  14m 5516 S    2  0.0   0:00.08 apache2                                                                                  
28077 root      20   0 19340 1656 1020 R    1  0.0   0:00.20 top                                                                                      
27948 www-data  20   0  245m  13m 5148 S    1  0.0   0:00.05 apache2                                                                                  
27976 www-data  20   0  245m  14m 5284 S    1  0.0   0:00.17 apache2                                                                                  
28032 www-data  20   0  248m  15m 5280 S    1  0.0   0:00.10 apache2</pre>
<br />
So it should be the queries, but the queries was running fine in old server. Mysql version, apache versión, and debian version is the same, only have changed the hardware, now 24 cpus, 32GB RAM, better than previous.<br />
<br />
In mysql the processlist:<br />
<pre class="bbcode">
mysql&gt; show full processlist;
+-------+------------+-----------+------------+---------+------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Id    | User       | Host      | db         | Command | Time | State                | Info                                                                                                                                                                                                                                                                 |
+-------+------------+-----------+------------+---------+------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 10161 | root       | localhost | artigoo_es | Query   |    0 | NULL                 | show full processlist                                                                                                                                                                                                                                                |
| 22594 | artigoo_es | localhost | artigoo_es | Query   |    4 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;adrid&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                      |
| 22595 | artigoo_es | localhost | artigoo_es | Query   |    3 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;aduana&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                     |
| 22596 | artigoo_es | localhost | artigoo_es | Query   |    3 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;advertencia&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                |
| 22597 | artigoo_es | localhost | artigoo_es | Query   |    3 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;aefa&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                       |
| 22598 | artigoo_es | localhost | artigoo_es | Query   |    3 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;ahorra&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                     |
| 22600 | artigoo_es | localhost | artigoo_es | Query   |    1 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;mp3&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                        |
| 22604 | artigoo_es | localhost | artigoo_es | Query   |    2 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;cocina-casera&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                              |
| 22605 | artigoo_es | localhost | artigoo_es | Query   |    1 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;mp3&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                        |
| 22606 | artigoo_es | localhost | artigoo_es | Query   |    1 | Copying to tmp table | SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;cocina-faci&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40                                                                                |
| 22609 | artigoo_es | localhost | artigoo_es | Query   |    2 | Copying to tmp table | select g.title, g.url, u.username, g.metadesc from goos as g, users as u, tags as t, goorank as gr where g.idstategoo=1 and u.iduser=g.iduser and g.idgoo=gr.idgoo and t.ftag=&quot;cocina-facil&quot; and t.id=g.idgoo group by g.idgoo order by gr.quality desc LIMIT 90, 10 |
+-------+------------+-----------+------------+---------+------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
11 rows in set (0.00 sec)

That query explain:
<pre class="bbcode">
mysql&gt; explain SELECT t.tag, t.ftag, COUNT(tag) AS total FROM tags AS t JOIN goos AS g ON t.id = g.idgoo WHERE t.ftag=&quot;mp3&quot; and g.idstategoo=1 GROUP BY t.tag ORDER BY total desc LIMIT 0,40;
+----+-------------+-------+-------+------------------------------+--------------------------+---------+--------------------+-------+-----------------------------------------------------------+
| id | select_type | table | type  | possible_keys                | key                      | key_len | ref                | rows  | Extra                                                     |
+----+-------------+-------+-------+------------------------------+--------------------------+---------+--------------------+-------+-----------------------------------------------------------+
|  1 | SIMPLE      | g     | index | PRIMARY,idx_idgoo_idstategoo | idx_idgoo_idstategoo     | 9       | NULL               | 44860 | Using where; Using index; Using temporary; Using filesort |
|  1 | SIMPLE      | t     | ref   | idx_tag_id_idcontenttype     | idx_tag_id_idcontenttype | 5       | artigoo_es.g.idgoo |     2 | Using where                                               |
+----+-------------+-------+-------+------------------------------+--------------------------+---------+--------------------+-------+-----------------------------------------------------------+
2 rows in set (0.00 sec)</pre>
<br />
That query spent about 6 sec when the server are with high load, but only 0.72 sec when it is normal.<br />
Not always is that query, I already have activated slow queries and i found lot of them. Always same status &quot;Copying to tmp table&quot;.<br />
<br />
By the way, my system memory usage:<br />
<pre class="bbcode">
# free
             total       used       free     shared    buffers     cached
Mem:      32979568   27272216    5707352          0     932860   19774576
-/+ buffers/cache:    6564780   26414788
Swap:      7999992       6788    7993204</pre>
<br />
As you can see, I have about 25GB free (about 5GB truly free and another 26GB in cache, which can be use if necesary).<br />
<br />
Some other stats:<br />
<br />
<pre class="bbcode">
mysql&gt; show engine innodb status\G
*************************** 1. row ***************************
  Type: InnoDB
  Name: 
Status: 
=====================================
130514 20:21:28 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 22 seconds
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 375146125, signal count 358559755
Mutex spin waits 0, rounds 133666397543, OS waits 226613066
RW-shared spins 30516517, OS waits 2475040; RW-excl spins 14667880, OS waits 696823
------------
TRANSACTIONS
------------
Trx id counter 0 24016085
Purge done for trx's n:o &lt; 0 24016065 undo n:o &lt; 0 0
History list length 1
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 24016079, not started, process no 31390, OS thread id 139647571896064
MySQL thread id 22814, query id 716143 localhost artigoo_es Table lock
select title, url, date(create_date) as date, (select sum(pageviews) from analytics where idgoo=goos.idgoo) as visits from goos where iduser=1625 and idstategoo=1 order by title
---TRANSACTION 0 24016065, not started, process no 31390, OS thread id 139642324195072
MySQL thread id 22813, query id 716129 localhost artigoo_es Table lock
update goos set metakeys=&quot;grafeno, grafito, matertial, futuro, l�mina&quot;, title=&quot;Grafeno el material del futuro&quot;, url=&quot;grafeno-material-futuro&quot;, update_date=now() where idgoo=45215 and iduser=13167
---TRANSACTION 0 24015879, not started, process no 31390, OS thread id 139642329331456
MySQL thread id 10161, query id 716148 localhost root
show engine innodb status
---TRANSACTION 0 24016084, ACTIVE 10 sec, process no 31390, OS thread id 139642327709440 starting index read, thread declared inside InnoDB 453
mysql tables in use 2, locked 0
MySQL thread id 22785, query id 716104 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;incidentes-river&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016083, ACTIVE 10 sec, process no 31390, OS thread id 139642325006080 sleeping before joining InnoDB queue
mysql tables in use 3, locked 0
MySQL thread id 22819, query id 716124 localhost artigoo_es Copying to tmp table
select g.title, g.url, u.username, g.metadesc from goos as g, users as u, tags as t, goorank as gr where g.idstategoo=1 and u.iduser=g.iduser and g.idgoo=gr.idgoo and t.ftag=&quot;mejillones-rellenos&quot; and t.id=g.idgoo group by g.idgoo order by gr.quality desc
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016082, ACTIVE 10 sec, process no 31390, OS thread id 139647572166400 starting index read, thread declared inside InnoDB 440
mysql tables in use 2, locked 0
MySQL thread id 22780, query id 716098 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;ideas-recomendaciones&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016081, ACTIVE 10 sec, process no 31390, OS thread id 139642325411584 starting index read, thread declared inside InnoDB 159
mysql tables in use 2, locked 0
MySQL thread id 22781, query id 716094 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;inaki-pinuel&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016080, ACTIVE 10 sec, process no 31390, OS thread id 139642317977344 waiting in InnoDB queue
mysql tables in use 2, locked 0
MySQL thread id 22784, query id 716100 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;ideas-decorar&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016078, ACTIVE 10 sec, process no 31390, OS thread id 139642323519232 starting index read, thread declared inside InnoDB 73
mysql tables in use 3, locked 0
MySQL thread id 22811, query id 716127 localhost artigoo_es Copying to tmp table
select g.title, g.url, u.username, g.metadesc from goos as g, users as u, tags as t, goorank as gr where g.idstategoo=1 and u.iduser=g.iduser and g.idgoo=gr.idgoo and t.ftag=&quot;cocino&quot; and t.id=g.idgoo group by g.idgoo order by gr.quality desc LIMIT 0, 10
Trx read view will not see trx with id &gt;= 0 24016082, sees &lt; 0 24016069
---TRANSACTION 0 24016077, ACTIVE 10 sec, process no 31390, OS thread id 139647571760896 starting index read, thread declared inside InnoDB 110
mysql tables in use 3, locked 0
MySQL thread id 22818, query id 716125 localhost artigoo_es Copying to tmp table
select g.title, g.url, u.username, g.metadesc from goos as g, users as u, tags as t, goorank as gr where g.idstategoo=1 and u.iduser=g.iduser and g.idgoo=gr.idgoo and t.ftag=&quot;megadeth&quot; and t.id=g.idgoo group by g.idgoo order by gr.quality desc
Trx read view will not see trx with id &gt;= 0 24016082, sees &lt; 0 24016069
---TRANSACTION 0 24016076, ACTIVE 10 sec, process no 31390, OS thread id 139642329736960 fetching rows, thread declared inside InnoDB 359
mysql tables in use 2, locked 0
MySQL thread id 22783, query id 716103 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;inauguracion&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016075, ACTIVE 10 sec, process no 31390, OS thread id 139642328520448 sleeping before joining InnoDB queue
mysql tables in use 2, locked 0
MySQL thread id 22782, query id 716095 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;inaki&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016074, ACTIVE 10 sec, process no 31390, OS thread id 139642318112512 fetching rows, thread declared inside InnoDB 221
mysql tables in use 2, locked 0
MySQL thread id 22778, query id 716097 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;idealizar&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016073, ACTIVE 10 sec, process no 31390, OS thread id 139642321086208 sleeping before joining InnoDB queue
mysql tables in use 2, locked 0
MySQL thread id 22776, query id 716096 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;idealistaes&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016072, ACTIVE 10 sec, process no 31390, OS thread id 139642319329024 sleeping before joining InnoDB queue
mysql tables in use 2, locked 0
MySQL thread id 22777, query id 716101 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;idea-despedidas&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016071, ACTIVE 10 sec, process no 31390, OS thread id 139642318247680 sleeping before joining InnoDB queue
mysql tables in use 2, locked 0
MySQL thread id 22779, query id 716102 localhost artigoo_es Copying to tmp table
select c.category, c.category_url, count(c.category) as total from categories as c, goos as g, tags as t where t.ftag=&quot;impresionante&quot; and t.id=g.idgoo and g.idcat=c.idcategory group by c.category order by total desc limit 0,10
Trx read view will not see trx with id &gt;= 0 24016085, sees &lt; 0 24016069
---TRANSACTION 0 24016070, ACTIVE 10 sec, process no 31390, OS thread id 139642325546752 fetching rows, thread declared inside InnoDB 480
mysql tables in use 3, locked 0
MySQL thread id 22806, query id 716123 localhost artigoo_es Copying to tmp table
select g.title, g.url, u.username, g.metadesc from goos as g, users as u, tags as t, goorank as gr where g.idstategoo=1 and u.iduser=g.iduser and g.idgoo=gr.idgoo and t.ftag=&quot;inciensos&quot; and t.id=g.idgoo group by g.idgoo order by gr.quality desc LIMIT 0, 10
Trx read view will not see trx with id &gt;= 0 24016074, sees &lt; 0 24016069
---TRANSACTION 0 24016069, ACTIVE 10 sec, process no 31390, OS thread id 139642326087424 waiting in InnoDB queue
mysql tables in use 3, locked 0
MySQL thread id 22812, query id 716126 localhost artigoo_es Copying to tmp table
select g.title, g.url, u.username, g.metadesc from goos as g, users as u, tags as t, goorank as gr where g.idstategoo=1 and u.iduser=g.iduser and g.idgoo=gr.idgoo and t.ftag=&quot;cizanero&quot; and t.id=g.idgoo group by g.idgoo order by gr.quality desc LIMIT 0, 10
Trx read view will not see trx with id &gt;= 0 24016074, sees &lt; 0 24016070
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (write thread)
Pending normal aio reads: 0, aio writes: 0,
 ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 0; buffer pool: 0
113312 OS file reads, 1308072 OS file writes, 69295 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 1.18 writes/s, 0.59 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 23, seg size 25,
2354 inserts, 2354 merged recs, 661 merges
Hash table size 8850487, node heap has 14181 buffer(s)
275921.14 hash searches/s, 6189.22 non-hash searches/s
---
LOG
---
Log sequence number 4 462958358
Log flushed up to   4 462958358
Last checkpoint at  4 462958358
0 pending log writes, 0 pending chkp writes
429136 log i/o's done, 0.27 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 4754045874; in additional pool allocated 1045760
Dictionary memory allocated 720952
Buffer pool size   262144
Free buffers       52225
Database pages     195738
Modified db pages  0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages read 211942, created 148049, written 1625483
0.00 reads/s, 0.00 creates/s, 0.91 writes/s
Buffer pool hit rate 1000 / 1000
--------------
ROW OPERATIONS
--------------
8 queries inside InnoDB, 7 queries in queue
16 read views open inside InnoDB
Main thread process no. 31390, id 139642338264832, state: sleeping
Number of rows inserted 10078554, updated 402156, deleted 315, read 9406695475
0.23 inserts/s, 0.00 updates/s, 0.23 deletes/s, 286462.98 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.00 sec)</pre>
<br />
And here you are the my.cnf:<br />
<br />
<pre class="bbcode">
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - &quot;/etc/mysql/my.cnf&quot; to set global options,
# - &quot;~/.my.cnf&quot; to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# <a href="http://dev.mysql.com/doc/mysql/en/server-system-variables.html"  rel="nofollow">http://dev.mysql.com/doc/mysql/en/server-system-variables.html</a>

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain &quot;#&quot; chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
language	= /usr/share/mysql/english
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address		= 127.0.0.1
#
# * Fine Tuning
#
#############################################
############### Innodb Tuning ###############
#############################################
innodb_buffer_pool_size	= 4096M 
#innodb_log_file_size	= 128M
innodb_log_buffer_size	= 4M
innodb_flush_log_at_trx_commit	= 2
innodb_thread_concurrency	= 8
innodb_flush_method	= O_DIRECT
innodb_file_per_table
transaction-isolation	= READ-COMMITTED

#############################################
############### MyIsam Tuning ###############
#############################################
key_buffer		= 512M #Aumentado de 16M a 512M el 2011/06/26
max_allowed_packet	= 16M
thread_stack		= 128K
thread_cache_size	= 8
read_buffer_size	= 4M
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover		= BACKUP
max_connections        	= 1000
table_cache            	= 512
table_definition_cache 	= 2048
open_files_limit	= 1536
#thread_concurrency     = 10
#
#Minimo de letras a buscar
ft_min_word_len		= 2
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log		= /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
log_slow_queries	= /var/log/mysql/mysql-slow.log
long_query_time = 10
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id		= 1
#log_bin			= /var/log/mysql/mysql-bin.log
expire_logs_days	= 10
max_binlog_size         = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
#skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI &quot;tinyca&quot;.
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]
key_buffer		= 16M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/</pre>
<br />
Finally the mysqltuner, there are some recommendations but because mysql wasn't up 24h, they are not very real.<br />
<br />
<pre class="bbcode">
 &gt;&gt;  MySQLTuner 1.0.1 - Major Hayden &lt;major@mhtx.net&gt;
 &gt;&gt;  Bug reports, feature requests, and downloads at <a href="http://mysqltuner.com/"  rel="nofollow">http://mysqltuner.com/</a>
 &gt;&gt;  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials passed on the command line

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.66-0+squeeze1-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 1G (Tables: 214)
[--] Data in InnoDB tables: 2G (Tables: 119)
[!!] Total fragmented tables: 46

-------- Performance Metrics -------------------------------------------------
[--] Up for: 17h 40m 11s (718K q [11.299 qps], 23K conn, TX: 4B, RX: 56M)
[--] Reads / Writes: 15% / 85%
[--] Total buffers: 4.5G global + 6.5M per thread (1000 max threads)
[OK] Maximum possible memory usage: 10.9G (34% of installed RAM)
[OK] Slow queries: 1% (11K/718K)
[OK] Highest usage of available connections: 11% (110/1000)
[OK] Key buffer size / total MyISAM indexes: 512.0M/501.4M
[OK] Key buffer hit rate: 100.0% (970M cached / 436K reads)
[OK] Query cache efficiency: 45.8% (72K cached / 158K selects)
[!!] Query cache prunes per day: 18526
[OK] Sorts requiring temporary tables: 0% (178 temp sorts / 1M sorts)
[OK] Temporary tables created on disk: 2% (832 on disk / 32K total)
[OK] Thread cache hit rate: 88% (2K created / 23K connections)
[!!] Table cache hit rate: 16% (512 open / 3K opened)
[OK] Open file limit used: 10% (509/5K)
[OK] Table locks acquired immediately: 99% (638K immediate / 639K locks)
[OK] InnoDB data size / buffer pool: 2.6G/4.0G

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    query_cache_size (&gt; 16M)
    table_cache (&gt; 512)</pre>
<br />
I run optimize and repair in more important tables, so I think 46 fragmented table could unused dbs or because many tables are innodb.<br />
<br />
In previous server, I had some error like this, but it was because there was different with system timezone and localtime file in etc. When I configured same in both, previous server become stable.<br />
In this server this is not the problem, and I'm a little lost.<br />
<br />
Any idea ? If you need some other info, please tell me.<br />
<br />
Thanks and best regards.</pre>]]></description>
            <dc:creator>Marco Ramirez</dc:creator>
            <category>Performance</category>
            <pubDate>Fri, 17 May 2013 03:46:52 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,585686,585686#msg-585686</guid>
            <title>Queries locking up (4 replies)</title>
            <link>http://forums.mysql.com/read.php?24,585686,585686#msg-585686</link>
            <description><![CDATA[ The biggest performance hit on my site are these queries:<br />
<br />
SELECT COUNT (*) FROM `item` WHERE item.item_type_id = ? AND item.has_photo = ?<br />
<br />
SELECT item.* FROM `item` WHERE item.item_type_id = ? AND item.has_photo = ? ORDER BY normalized_time DESC LIMIT ?, ?<br />
<br />
I'm wondering if a MySQL expert (like most of the people on these forums) were to see these queries do you instantly know they can be improved?<br />
<br />
The queries are for Lionseek.com -  I hate slow sites and I know the visitors do as well. Need some recommendations on getting the queries improved. Please help!<br />
<br />
<a href="http://www.lionseek.com/locked.png"  rel="nofollow">http://www.lionseek.com/locked.png</a>]]></description>
            <dc:creator>Thomas Kazarian</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 16 May 2013 03:33:02 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,585487,585487#msg-585487</guid>
            <title>Composite index - selecting components and order (9 replies)</title>
            <link>http://forums.mysql.com/read.php?24,585487,585487#msg-585487</link>
            <description><![CDATA[ How do you decide which items and in what order to place them in a composite index:<br />
<br />
- the SELECT has elements where min or max are chosen<br />
<br />
- the WHERE clause has multiple elements<br />
<br />
- there is a GROUP BY<br />
<br />
- there is an ORDER BY which is also one of the min elements of the SELECT]]></description>
            <dc:creator>Rick Ingram</dc:creator>
            <category>Performance</category>
            <pubDate>Fri, 10 May 2013 04:56:29 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,585478,585478#msg-585478</guid>
            <title>How MySQL Uses Indexes (7 replies)</title>
            <link>http://forums.mysql.com/read.php?24,585478,585478#msg-585478</link>
            <description><![CDATA[ I create a table as follows:<br />
CREATE TABLE IF NOT EXISTS `t` (<br />
   `id` int (11) NOT NULL AUTO_INCREMENT,<br />
   `i` date NOT NULL,<br />
   `o` date NOT NULL,<br />
   PRIMARY KEY (`id`),<br />
   Index0 KEY `` (`i`)<br />
<br />
)<br />
to test the performance of my query I do:<br />
explain select * from t o Where&gt; '2013-05-04 'and i &lt;'2013-05-11';<br />
I got the following output on my local computer:<br />
<br />
| select_type | table | Type  | possible_keys | key | key_len | ref | rows<br />
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- + <br />
| SIMPLE      | t     | range | a, b          ​​| b   | 3       | NULL | 84 | Using where |<br />
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- + <br />
<br />
While on a remote server, I get:<br />
<br />
| select_type | table | Type  | possible_keys | key | key_len | ref | rows<br />
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- + <br />
| SIMPLE      | t     | ALL   | a, b          ​​| null   | 3       | NULL | 84 | Using where |<br />
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- +<br />
<br />
This means that MySQL uses the index locally, but not on the remote server. Why?]]></description>
            <dc:creator>Mola Ji</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 09 May 2013 03:04:56 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,585272,585272#msg-585272</guid>
            <title>Hardware sizing tools (3 replies)</title>
            <link>http://forums.mysql.com/read.php?24,585272,585272#msg-585272</link>
            <description><![CDATA[ Hi,<br />
Does anyone know of any tools, in which I can plug in a bunch of information about the specs of our drives, information gathered from the Dell DPACK, and the Percona Cacti graphs in order to help me make a informed hardware decision?<br />
<br />
I have used some IOPS calculators and they have helped a bit I'm wondering if there are tools more specific to MySQL hardware sizing.<br />
<br />
Thanks,<br />
James]]></description>
            <dc:creator>James Marcus</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 04 May 2013 19:34:04 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,585170,585170#msg-585170</guid>
            <title>cache not used with restricted privileges ? (3 replies)</title>
            <link>http://forums.mysql.com/read.php?24,585170,585170#msg-585170</link>
            <description><![CDATA[ Hi, <br />
<br />
I have a database with theses privileges:<br />
	- an user who have all privileges &quot;user1&quot;.<br />
	- an user with restricted privileges to some tables or view &quot;user2&quot;.<br />
	<br />
When I send a select request like i.e. &quot;SELECT * FROM film, sales_by_store LIMIT 1;&quot; with an user who have : <br />
	GRANT SELECT ON `sakila`.* TO 'user1'@'localhost';<br />
for first time :<br />
1 row in set (0.04 sec) <br />
<br />
and then I repeat this sql :<br />
1 row in set (0.00 sec) <br />
1 row in set (0.00 sec) <br />
1 row in set (0.00 sec) <br />
<br />
with user2 : <br />
GRANT SELECT ON sakila.sales_by_store TO 'user2'@'localhost';<br />
GRANT SELECT ON sakila.film TO 'user2'@'localhost';<br />
<br />
time execution are same : <br />
1 row in set (0.04 sec)<br />
1 row in set (0.04 sec)<br />
1 row in set (0.04 sec)<br />
<br />
Why the cache is not used ?]]></description>
            <dc:creator>brocu lus</dc:creator>
            <category>Performance</category>
            <pubDate>Fri, 03 May 2013 15:32:05 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,584723,584723#msg-584723</guid>
            <title>In-memory dB on Embedded system (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,584723,584723#msg-584723</link>
            <description><![CDATA[ Hi All,<br />
<br />
I am a newbie in database. Please excuse me, If my query sounds elementary. <br />
<br />
I have an Embedded Debian linux 2.6.35.9, mysql 5.1. <br />
<br />
My objective is to run the db in-memory, as in the long run it would damage the flash drive with too many read/write operations. <br />
<br />
Hence I want to run the db in-memory and to have data consistency, I want to write back the data to <br />
1. flash drive say every 2hrs(or may be less). <br />
2. Also during every system restart/shutdown, copy the data to/from memory from/to flash drive. <br />
<br />
Please help me with some pointers. I believe there exists some solution, as I have time constraints, I could not do exhaustive research. Hence any help is much appreciated. <br />
<br />
<br />
Thanks <br />
Sandhya]]></description>
            <dc:creator>Sandhya Srinivas</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 25 Apr 2013 04:51:57 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,584596,584596#msg-584596</guid>
            <title>mysql have lots of ' sleep null' process, and caused php takes up 100% cpu (2 replies)</title>
            <link>http://forums.mysql.com/read.php?24,584596,584596#msg-584596</link>
            <description><![CDATA[ Hi All,<br />
<br />
I'm using php and mysql to host a forum.<br />
Currently we have about 10,000 users online at the same time.<br />
The database is about 8G. <br />
nginx+php-fpm+mysql are running on the same servers. The server has 32G memory and 2 * 16 core CPUs.<br />
<br />
Now I found that once the users number is bigger than 10000, php-fpm always takes up all CPU resources. When the issue happens, I checked mysql using 'show full processlist', and found that there are hundreds of 'sleep and null' querys like below<br />
<br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                                                                                                     <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL                                                                           <br />
 | localhost | forums | Sleep   |    0 |                              | NULL<br />
<br />
<br />
Below is my.cnf<br />
<br />
[client]<br />
port		= 3306<br />
socket		= /tmp/mysql.sock<br />
<br />
[mysqld]<br />
server-id	= 1<br />
port		= 3306<br />
socket		= /tmp/mysql.sock<br />
default-storage-engine=MyISAM<br />
ignore-builtin-innodb<br />
skip-external-locking<br />
skip-networking<br />
skip-name-resolve<br />
event_scheduler = 1<br />
<br />
sql-mode = NO_UNSIGNED_SUBTRACTION<br />
<br />
max_allowed_packet = 64M<br />
max_connections = 768<br />
max_connect_errors = 1844674407370954751<br />
<br />
slow_launch_time=2<br />
general-log=0<br />
slow_query_log=1<br />
slow-query-log-file=/log/slowquery.log<br />
long_query_time=2<br />
wait_timeout = 10<br />
connect_timeout = 10<br />
interactive_timeout = 10<br />
<br />
tmp_table_size=512M<br />
max_heap_table_size=512M<br />
key_buffer_size = 512M<br />
join_buffer_size = 3M<br />
read_buffer_size = 4M<br />
sort_buffer_size =4M<br />
myisam_sort_buffer_size = 128M<br />
<br />
table_open_cache = 2048<br />
read_rnd_buffer_size = 8M<br />
<br />
query_cache_limit = 2M<br />
query_cache_size = 1024M<br />
query_cache_min_res_unit = 2K<br />
<br />
thread_concurrency = 48<br />
thread_cache_size = 512<br />
<br />
open-files-limit=10240<br />
<br />
low-priority-updates=1<br />
concurrent_insert=ALWAYS<br />
<br />
[mysqldump]<br />
quick<br />
max_allowed_packet = 20M<br />
<br />
[mysql]<br />
no-auto-rehash<br />
# Remove the next comment character if you are not familiar with SQL<br />
#safe-updates<br />
<br />
[myisamchk]<br />
key_buffer_size = 256M<br />
sort_buffer_size = 256M<br />
read_buffer = 64M<br />
write_buffer = 64M<br />
<br />
[mysqlhotcopy]<br />
interactive-timeout<br />
<br />
<br />
And tuning-primer.sh<br />
<br />
SLOW QUERIES<br />
The slow query log is enabled.<br />
Current long_query_time = 2.000000 sec.<br />
You have 285 out of 5751642 that take longer than 2.000000 sec. to complete<br />
[: 0.00000000000000000000: bad number<br />
Your long_query_time seems to be fine<br />
<br />
BINARY UPDATE LOG<br />
The binary update log is NOT enabled.<br />
You will not be able to do point in time recovery<br />
See <a href="http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html"  rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html</a><br />
<br />
WORKER THREADS<br />
Current thread_cache_size = 512<br />
Current threads_cached = 248<br />
Current threads_per_sec = 0<br />
Historic threads_per_sec = 0<br />
Your thread_cache_size is fine<br />
<br />
MAX CONNECTIONS<br />
Current max_connections = 768<br />
Current threads_connected = 4<br />
Historic max_used_connections = 253<br />
The number of used connections is 32% of the configured maximum.<br />
Your max_connections variable seems to be fine.<br />
<br />
No InnoDB Support Enabled!<br />
<br />
MEMORY USAGE<br />
Max Memory Ever Allocated : 6.25 G<br />
Configured Max Per-thread Buffers : 14.43 G<br />
Configured Max Global Buffers : 1.50 G<br />
Configured Max Memory Limit : 15.93 G<br />
Physical Memory : 32.75 G<br />
Max memory limit seem to be within acceptable norms<br />
<br />
KEY BUFFER<br />
Current MyISAM index space = 1.51 G<br />
Current key_buffer_size = 512 M<br />
Key cache miss rate is 1 : 334<br />
Key buffer free ratio = 40 %<br />
Your key_buffer_size seems to be too high.<br />
Perhaps you can use these resources elsewhere<br />
<br />
QUERY CACHE<br />
Query cache is enabled<br />
Current query_cache_size = 1.00 G<br />
Current query_cache_used = 194 M<br />
Current query_cache_limit = 2 M<br />
Current Query cache Memory fill ratio = 18.96 %<br />
Current query_cache_min_res_unit = 2 K<br />
Your query_cache_size seems to be too high.<br />
Perhaps you can use these resources elsewhere<br />
MySQL won't cache query results that are larger than query_cache_limit in size<br />
<br />
SORT OPERATIONS<br />
Current sort_buffer_size = 4 M<br />
Current read_rnd_buffer_size = 8 M<br />
Sort buffer seems to be fine<br />
<br />
JOINS<br />
Current join_buffer_size = 3.00 M<br />
You have had 0 queries where a join could not use an index properly<br />
Your joins seem to be using indexes properly<br />
<br />
OPEN FILES LIMIT<br />
Current open_files_limit = 10240 files<br />
The open_files_limit should typically be set to at least 2x-3x<br />
that of table_cache if you have heavy MyISAM usage.<br />
Your open_files_limit value seems to be fine<br />
<br />
TABLE CACHE<br />
Current table_open_cache = 2048 tables<br />
Current table_definition_cache = 400 tables<br />
You have a total of 347 tables<br />
You have 676 open tables.<br />
The table_cache value seems to be fine<br />
<br />
TEMP TABLES<br />
Current max_heap_table_size = 512 M<br />
Current tmp_table_size = 512 M<br />
Of 2971 temp tables, 6% were created on disk<br />
Created disk tmp tables ratio seems fine<br />
<br />
TABLE SCANS<br />
Current read_buffer_size = 4 M<br />
Current table scan ratio = 323 : 1<br />
read_buffer_size seems to be fine<br />
<br />
TABLE LOCKING<br />
Current Lock Wait ratio = 1 : 90<br />
You may benefit from selective use of InnoDB.<br />
<br />
<br />
<br />
And show status;<br />
<br />
mysql&gt; show status;<br />
+------------------------------------------+-------------+<br />
| Variable_name                            | Value       |<br />
+------------------------------------------+-------------+<br />
| Aborted_clients                          | 1330        |<br />
| Aborted_connects                         | 5           |<br />
| Binlog_cache_disk_use                    | 0           |<br />
| Binlog_cache_use                         | 0           |<br />
| Binlog_stmt_cache_disk_use               | 0           |<br />
| Binlog_stmt_cache_use                    | 0           |<br />
| Bytes_received                           | 137         |<br />
| Bytes_sent                               | 183         |<br />
| Com_admin_commands                       | 0           |<br />
| Com_assign_to_keycache                   | 0           |<br />
| Com_alter_db                             | 0           |<br />
| Com_alter_db_upgrade                     | 0           |<br />
| Com_alter_event                          | 0           |<br />
| Com_alter_function                       | 0           |<br />
| Com_alter_procedure                      | 0           |<br />
| Com_alter_server                         | 0           |<br />
| Com_alter_table                          | 0           |<br />
| Com_alter_tablespace                     | 0           |<br />
| Com_analyze                              | 0           |<br />
| Com_begin                                | 0           |<br />
| Com_binlog                               | 0           |<br />
| Com_call_procedure                       | 0           |<br />
| Com_change_db                            | 0           |<br />
| Com_change_master                        | 0           |<br />
| Com_check                                | 0           |<br />
| Com_checksum                             | 0           |<br />
| Com_commit                               | 0           |<br />
| Com_create_db                            | 0           |<br />
| Com_create_event                         | 0           |<br />
| Com_create_function                      | 0           |<br />
| Com_create_index                         | 0           |<br />
| Com_create_procedure                     | 0           |<br />
| Com_create_server                        | 0           |<br />
| Com_create_table                         | 0           |<br />
| Com_create_trigger                       | 0           |<br />
| Com_create_udf                           | 0           |<br />
| Com_create_user                          | 0           |<br />
| Com_create_view                          | 0           |<br />
| Com_dealloc_sql                          | 0           |<br />
| Com_delete                               | 0           |<br />
| Com_delete_multi                         | 0           |<br />
| Com_do                                   | 0           |<br />
| Com_drop_db                              | 0           |<br />
| Com_drop_event                           | 0           |<br />
| Com_drop_function                        | 0           |<br />
| Com_drop_index                           | 0           |<br />
| Com_drop_procedure                       | 0           |<br />
| Com_drop_server                          | 0           |<br />
| Com_drop_table                           | 0           |<br />
| Com_drop_trigger                         | 0           |<br />
| Com_drop_user                            | 0           |<br />
| Com_drop_view                            | 0           |<br />
| Com_empty_query                          | 0           |<br />
| Com_execute_sql                          | 0           |<br />
| Com_flush                                | 0           |<br />
| Com_grant                                | 0           |<br />
| Com_ha_close                             | 0           |<br />
| Com_ha_open                              | 0           |<br />
| Com_ha_read                              | 0           |<br />
| Com_help                                 | 0           |<br />
| Com_insert                               | 0           |<br />
| Com_insert_select                        | 0           |<br />
| Com_install_plugin                       | 0           |<br />
| Com_kill                                 | 0           |<br />
| Com_load                                 | 0           |<br />
| Com_lock_tables                          | 0           |<br />
| Com_optimize                             | 0           |<br />
| Com_preload_keys                         | 0           |<br />
| Com_prepare_sql                          | 0           |<br />
| Com_purge                                | 0           |<br />
| Com_purge_before_date                    | 0           |<br />
| Com_release_savepoint                    | 0           |<br />
| Com_rename_table                         | 0           |<br />
| Com_rename_user                          | 0           |<br />
| Com_repair                               | 0           |<br />
| Com_replace                              | 0           |<br />
| Com_replace_select                       | 0           |<br />
| Com_reset                                | 0           |<br />
| Com_resignal                             | 0           |<br />
| Com_revoke                               | 0           |<br />
| Com_revoke_all                           | 0           |<br />
| Com_rollback                             | 0           |<br />
| Com_rollback_to_savepoint                | 0           |<br />
| Com_savepoint                            | 0           |<br />
| Com_select                               | 1           |<br />
| Com_set_option                           | 0           |<br />
| Com_signal                               | 0           |<br />
| Com_show_authors                         | 0           |<br />
| Com_show_binlog_events                   | 0           |<br />
| Com_show_binlogs                         | 0           |<br />
| Com_show_charsets                        | 0           |<br />
| Com_show_collations                      | 0           |<br />
| Com_show_contributors                    | 0           |<br />
| Com_show_create_db                       | 0           |<br />
| Com_show_create_event                    | 0           |<br />
| Com_show_create_func                     | 0           |<br />
| Com_show_create_proc                     | 0           |<br />
| Com_show_create_table                    | 0           |<br />
| Com_show_create_trigger                  | 0           |<br />
| Com_show_databases                       | 0           |<br />
| Com_show_engine_logs                     | 0           |<br />
| Com_show_engine_mutex                    | 0           |<br />
| Com_show_engine_status                   | 0           |<br />
| Com_show_events                          | 0           |<br />
| Com_show_errors                          | 0           |<br />
| Com_show_fields                          | 0           |<br />
| Com_show_function_status                 | 0           |<br />
| Com_show_grants                          | 0           |<br />
| Com_show_keys                            | 0           |<br />
| Com_show_master_status                   | 0           |<br />
| Com_show_open_tables                     | 0           |<br />
| Com_show_plugins                         | 0           |<br />
| Com_show_privileges                      | 0           |<br />
| Com_show_procedure_status                | 0           |<br />
| Com_show_processlist                     | 0           |<br />
| Com_show_profile                         | 0           |<br />
| Com_show_profiles                        | 0           |<br />
| Com_show_relaylog_events                 | 0           |<br />
| Com_show_slave_hosts                     | 0           |<br />
| Com_show_slave_status                    | 0           |<br />
| Com_show_status                          | 1           |<br />
| Com_show_storage_engines                 | 0           |<br />
| Com_show_table_status                    | 0           |<br />
| Com_show_tables                          | 0           |<br />
| Com_show_triggers                        | 0           |<br />
| Com_show_variables                       | 0           |<br />
| Com_show_warnings                        | 0           |<br />
| Com_slave_start                          | 0           |<br />
| Com_slave_stop                           | 0           |<br />
| Com_stmt_close                           | 0           |<br />
| Com_stmt_execute                         | 0           |<br />
| Com_stmt_fetch                           | 0           |<br />
| Com_stmt_prepare                         | 0           |<br />
| Com_stmt_reprepare                       | 0           |<br />
| Com_stmt_reset                           | 0           |<br />
| Com_stmt_send_long_data                  | 0           |<br />
| Com_truncate                             | 0           |<br />
| Com_uninstall_plugin                     | 0           |<br />
| Com_unlock_tables                        | 0           |<br />
| Com_update                               | 0           |<br />
| Com_update_multi                         | 0           |<br />
| Com_xa_commit                            | 0           |<br />
| Com_xa_end                               | 0           |<br />
| Com_xa_prepare                           | 0           |<br />
| Com_xa_recover                           | 0           |<br />
| Com_xa_rollback                          | 0           |<br />
| Com_xa_start                             | 0           |<br />
| Compression                              | OFF         |<br />
| Connections                              | 532549      |<br />
| Created_tmp_disk_tables                  | 0           |<br />
| Created_tmp_files                        | 18890       |<br />
| Created_tmp_tables                       | 0           |<br />
| Delayed_errors                           | 0           |<br />
| Delayed_insert_threads                   | 0           |<br />
| Delayed_writes                           | 0           |<br />
| Flush_commands                           | 1           |<br />
| Handler_commit                           | 0           |<br />
| Handler_delete                           | 0           |<br />
| Handler_discover                         | 0           |<br />
| Handler_prepare                          | 0           |<br />
| Handler_read_first                       | 0           |<br />
| Handler_read_key                         | 0           |<br />
| Handler_read_last                        | 0           |<br />
| Handler_read_next                        | 0           |<br />
| Handler_read_prev                        | 0           |<br />
| Handler_read_rnd                         | 0           |<br />
| Handler_read_rnd_next                    | 0           |<br />
| Handler_rollback                         | 0           |<br />
| Handler_savepoint                        | 0           |<br />
| Handler_savepoint_rollback               | 0           |<br />
| Handler_update                           | 0           |<br />
| Handler_write                            | 0           |<br />
| Key_blocks_not_flushed                   | 0           |<br />
| Key_blocks_unused                        | 210429      |<br />
| Key_blocks_used                          | 218255      |<br />
| Key_read_requests                        | 75182109    |<br />
| Key_reads                                | 222986      |<br />
| Key_write_requests                       | 282796      |<br />
| Key_writes                               | 261528      |<br />
| Last_query_cost                          | 0.000000    |<br />
| Max_used_connections                     | 253         |<br />
| Not_flushed_delayed_rows                 | 0           |<br />
| Open_files                               | 969         |<br />
| Open_streams                             | 0           |<br />
| Open_table_definitions                   | 347         |<br />
| Open_tables                              | 676         |<br />
| Opened_files                             | 24897       |<br />
| Opened_table_definitions                 | 0           |<br />
| Opened_tables                            | 0           |<br />
| Performance_schema_cond_classes_lost     | 0           |<br />
| Performance_schema_cond_instances_lost   | 0           |<br />
| Performance_schema_file_classes_lost     | 0           |<br />
| Performance_schema_file_handles_lost     | 0           |<br />
| Performance_schema_file_instances_lost   | 0           |<br />
| Performance_schema_locker_lost           | 0           |<br />
| Performance_schema_mutex_classes_lost    | 0           |<br />
| Performance_schema_mutex_instances_lost  | 0           |<br />
| Performance_schema_rwlock_classes_lost   | 0           |<br />
| Performance_schema_rwlock_instances_lost | 0           |<br />
| Performance_schema_table_handles_lost    | 0           |<br />
| Performance_schema_table_instances_lost  | 0           |<br />
| Performance_schema_thread_classes_lost   | 0           |<br />
| Performance_schema_thread_instances_lost | 0           |<br />
| Prepared_stmt_count                      | 0           |<br />
| Qcache_free_blocks                       | 17584       |<br />
| Qcache_free_memory                       | 860674168   |<br />
| Qcache_hits                              | 1080677     |<br />
| Qcache_inserts                           | 1985418     |<br />
| Qcache_lowmem_prunes                     | 0           |<br />
| Qcache_not_cached                        | 9019        |<br />
| Qcache_queries_in_cache                  | 54664       |<br />
| Qcache_total_blocks                      | 127744      |<br />
| Queries                                  | 5815720     |<br />
| Questions                                | 2           |<br />
| Rpl_status                               | AUTH_MASTER |<br />
| Select_full_join                         | 0           |<br />
| Select_full_range_join                   | 0           |<br />
| Select_range                             | 0           |<br />
| Select_range_check                       | 0           |<br />
| Select_scan                              | 0           |<br />
| Slave_heartbeat_period                   | 0.000       |<br />
| Slave_open_temp_tables                   | 0           |<br />
| Slave_received_heartbeats                | 0           |<br />
| Slave_retried_transactions               | 0           |<br />
| Slave_running                            | OFF         |<br />
| Slow_launch_threads                      | 0           |<br />
| Slow_queries                             | 0           |<br />
| Sort_merge_passes                        | 0           |<br />
| Sort_range                               | 0           |<br />
| Sort_rows                                | 0           |<br />
| Sort_scan                                | 0           |<br />
| Ssl_accept_renegotiates                  | 0           |<br />
| Ssl_accepts                              | 0           |<br />
| Ssl_callback_cache_hits                  | 0           |<br />
| Ssl_cipher                               |             |<br />
| Ssl_cipher_list                          |             |<br />
| Ssl_client_connects                      | 0           |<br />
| Ssl_connect_renegotiates                 | 0           |<br />
| Ssl_ctx_verify_depth                     | 0           |<br />
| Ssl_ctx_verify_mode                      | 0           |<br />
| Ssl_default_timeout                      | 0           |<br />
| Ssl_finished_accepts                     | 0           |<br />
| Ssl_finished_connects                    | 0           |<br />
| Ssl_session_cache_hits                   | 0           |<br />
| Ssl_session_cache_misses                 | 0           |<br />
| Ssl_session_cache_mode                   | NONE        |<br />
| Ssl_session_cache_overflows              | 0           |<br />
| Ssl_session_cache_size                   | 0           |<br />
| Ssl_session_cache_timeouts               | 0           |<br />
| Ssl_sessions_reused                      | 0           |<br />
| Ssl_used_session_cache_entries           | 0           |<br />
| Ssl_verify_depth                         | 0           |<br />
| Ssl_verify_mode                          | 0           |<br />
| Ssl_version                              |             |<br />
| Table_locks_immediate                    | 3248854     |<br />
| Table_locks_waited                       | 35885       |<br />
| Tc_log_max_pages_used                    | 0           |<br />
| Tc_log_page_size                         | 0           |<br />
| Tc_log_page_waits                        | 0           |<br />
| Threads_cached                           | 245         |<br />
| Threads_connected                        | 8           |<br />
| Threads_created                          | 253         |<br />
| Threads_running                          | 6           |<br />
| Uptime                                   | 5375        |<br />
| Uptime_since_flush_status                | 5375        |<br />
+------------------------------------------+-------------+<br />
<br />
<br />
Anyone can help me to optimize mysql?]]></description>
            <dc:creator>Meteor SY</dc:creator>
            <category>Performance</category>
            <pubDate>Wed, 24 Apr 2013 05:22:13 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,584540,584540#msg-584540</guid>
            <title>pattern matching with LIKE or REGEXP (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,584540,584540#msg-584540</link>
            <description><![CDATA[ mysql searching use LIKE function<br />
i try to use LIKE function<br />
SELECT * FROM table.name WHERE coloum LIKE 'AA__';<br />
<br />
i want to show search result just 3to4 len of character<br />
<br />
and my table data selected contains<br />
AAA<br />
AAAA<br />
AA11<br />
AAAAAA<br />
AABBCCDD<br />
<br />
and the resulst just shown AAAA,AA11<br />
<br />
how to make resust show AAA (3 len of character)<br />
if pattern matching AA and 2 more character in _<br />
for regexp AA.{1,2}<br />
is any posible to use LIKE function for this patern matching?<br />
<br />
and there was an issue using REGEXP clause 10xtime slower than using LIKE]]></description>
            <dc:creator>Oka Putra</dc:creator>
            <category>Performance</category>
            <pubDate>Tue, 23 Apr 2013 14:33:45 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,584109,584109#msg-584109</guid>
            <title>Simple join taking longer than it should (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,584109,584109#msg-584109</link>
            <description><![CDATA[ I have a couple of tables to work with, they are horribly designed (not by me) but I'm trying to figure out why a specific query is taking a long time when its explain plan and indices show it being very simple to run.  Here is some info, this is a partial of a larger query that I am trying to run:<br />
<br />
SELECT<br />
	COUNT(*)<br />
FROM c <br />
JOIN ccd on ccd.c_code = c.c_code and ccd.data_id = 2 and ccd.`data` = &quot;LOCALTEST&quot;<br />
WHERE (<br />
    c.c_entry_date between date_sub(now(), INTERVAL 1 hour) and now() <br />
    OR c.c_entry_date between date_sub(now(), INTERVAL 169 hour) and date_sub(now(), INTERVAL 168 hour) <br />
    OR c.c_entry_date between date_sub(now(), INTERVAL 337 hour) and date_sub(now(), INTERVAL 336 hour)<br />
)<br />
<br />
The join to ccd is what is causing the delay, but the explain plan and indices look fine:<br />
<br />
id,select_type,table,type,possible_keys,key,key_len,ref,rows,filtered,Extra<br />
1,SIMPLE,c,range,c_code,c_entry,c_entry,8,NULL,82760,100.00,Using where<br />
1,SIMPLE,ccd,eq_ref,PRIMARY,PRIMARY,38,voicedb.c.c_code,const,1,100.00,Using index<br />
<br />
This is a VERY wide table, I'm only showing the fields in question.<br />
<br />
CREATE TABLE `c` (<br />
  `id` int(10) NOT NULL AUTO_INCREMENT,<br />
  `c_code` varchar(32) NOT NULL,<br />
  `c_entry_date` datetime NOT NULL,<br />
  ...<br />
  PRIMARY KEY (`id`),<br />
  KEY `c_code` (`c_code`),<br />
  KEY `c_entry` (`c_entry_date`),<br />
  ...<br />
) ENGINE=InnoDB AUTO_INCREMENT=50388509 DEFAULT CHARSET=latin1<br />
<br />
<br />
This one has a composite primary for some reason, but the query I'm running is using it.<br />
<br />
CREATE TABLE `ccd` (<br />
  `c_code` varchar(32) NOT NULL DEFAULT '',<br />
  `data_id` int(11) NOT NULL DEFAULT '0',<br />
  `data` text,<br />
  `created_at` timestamp NULL DEFAULT '1970-01-01 00:00:01',<br />
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,<br />
  PRIMARY KEY (`c_code`,`data_id`),<br />
  KEY `created_at` (`created_at`),<br />
  KEY `updated_at` (`updated_at`)<br />
) ENGINE=InnoDB DEFAULT CHARSET=latin1<br />
<br />
The query hangs on &quot;Sending Data&quot; for at least 5 minutes before I killed it.  The number of rows in `c` is about 50 million with about 200million rows in `ccd`.  I realize the unions through OR complicates things a bit but it shouldn't take that long.  Ive also tried setting optimizer_search_depth = 1 and optimizer_prune_level = 0; After reading bug #29821.  No help.<br />
<br />
Any Thoughts?]]></description>
            <dc:creator>Kenneth Mitchner</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 18 Apr 2013 03:04:56 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,584052,584052#msg-584052</guid>
            <title>MySQL database drop insanely slow (11 replies)</title>
            <link>http://forums.mysql.com/read.php?24,584052,584052#msg-584052</link>
            <description><![CDATA[ Hi, <br />
<br />
I just installed MySQL 5.0.45-log Source distribution on my Debian 6.0.6 server.<br />
<br />
I installed it under my user home directory like I'm used to doing.<br />
<br />
But this time the queries are extremely slow to run.<br />
<br />
Running a create table or a database drop takes ages. I can literally watch tv in the meantime.<br />
<br />
So I did a profiling of the database drop statement.<br />
<br />
<pre class="bbcode">
mysql&gt; SHOW PROFILES;
+----------+--------------+------------------------------+
| Query_ID | Duration     | Query                        |
+----------+--------------+------------------------------+
|        1 | 369.54719400 | drop database db_madeintouch | 
|        2 |   0.00004600 | SELECT DATABASE()            | 
+----------+--------------+------------------------------+
2 rows in set (0.00 sec)

mysql&gt; SHOW PROFILE FOR QUERY 1;
+----------------------+-----------+
| Status               | Duration  |
+----------------------+-----------+
| (initialization)     | 0.000001  | 
| checking permissions | 369.54705 | 
| Opening table        | 0.000103  | 
| System lock          | 0.000003  | 
| Table lock           | 0.000018  | 
| query end            | 0.000004  | 
| freeing items        | 0.000004  | 
| logging slow query   | 0.000002  | 
+----------------------+-----------+
8 rows in set (0.00 sec)</pre>
<br />
We can see the time it takes for the checking of permissions is of 369 seconds.<br />
<br />
I also did a show status of the InnoDB engine.<br />
<br />
<pre class="bbcode">
mysql&gt; show engine innodb status\G
*************************** 1. row ***************************
Status: 
=====================================
130415 23:11:27 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 9 seconds
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 781, signal count 781
Mutex spin waits 0, rounds 8629, OS waits 231
RW-shared spins 379, OS waits 190; RW-excl spins 380, OS waits 342
------------
TRANSACTIONS
------------
Trx id counter 0 7599
Purge done for trx's n:o &lt; 0 7430 undo n:o &lt; 0 0
History list length 3
Total number of lock structs in row lock hash table 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 0, not started, process no 14133, OS thread id 140617364518656
MySQL thread id 16, query id 1305 localhost stephane checking permissions
drop database db_madeintouch
---TRANSACTION 0 0, not started, process no 14133, OS thread id 140617364383488
MySQL thread id 13, query id 1307 localhost stephane
show engine innodb status
---TRANSACTION 0 7597, COMMITTED IN MEMORY, process no 14133, OS thread id 140617364518656 dropping table
COMMITTING , undo log entries 16
MySQL thread id 16, query id 1305 localhost stephane checking permissions
drop database db_madeintouch
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (write thread)
Pending normal aio reads: 0, aio writes: 0,
 ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 1; buffer pool: 0
174 OS file reads, 3781 OS file writes, 2099 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2,
0 inserts, 0 merged recs, 0 merges
Hash table size 17393, used cells 122, node heap has 1 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 0 7801057
Log flushed up to   0 7798962
Last checkpoint at  0 7798962
1 pending log writes, 0 pending chkp writes
1535 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 22136914; in additional pool allocated 1048576
Buffer pool size   512
Free buffers       2
Database pages     509
Modified db pages  18
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages read 183, created 1444, written 6980
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
1 read views open inside InnoDB
Main thread process no. 14133, id 140617334142720, state: waiting for server activity
Number of rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.00 sec)</pre>
<br />
<br />
And here is my environment.<br />
<br />
<pre class="bbcode">
mysql&gt; SHOW VARIABLES;


&gt; +---------------------------------+--------------------------------------------------------------------+ | Variable_name                   | Value                             
&gt; |
&gt; +---------------------------------+--------------------------------------------------------------------+ | auto_increment_increment        | 1                                 
&gt; |  | auto_increment_offset           | 1                              
&gt; |  | automatic_sp_privileges         | ON                             
&gt; |  | back_log                        | 50                             
&gt; |  | basedir                         |
&gt; /home/stephane/programs/mysql-5.0.45/install/                      | 
&gt; | binlog_cache_size               | 32768                             
&gt; |  | bulk_insert_buffer_size         | 8388608                        
&gt; |  | character_set_client            | latin1                         
&gt; |  | character_set_connection        | latin1                         
&gt; |  | character_set_database          | latin1                         
&gt; |  | character_set_filesystem        | binary                         
&gt; |  | character_set_results           | latin1                         
&gt; |  | character_set_server            | latin1                         
&gt; |  | character_set_system            | utf8                           
&gt; |  | character_sets_dir              |
&gt; /home/stephane/programs/mysql-5.0.45/install/share/mysql/charsets/ | 
&gt; | collation_connection            | latin1_swedish_ci                 
&gt; |  | collation_database              | latin1_swedish_ci              
&gt; |  | collation_server                | latin1_swedish_ci              
&gt; |  | completion_type                 | 0                              
&gt; |  | concurrent_insert               | 1                              
&gt; |  | connect_timeout                 | 5                              
&gt; |  | datadir                         |
&gt; /home/stephane/programs/mysql/install/data/                        | 
&gt; | date_format                     | %Y-%m-%d                          
&gt; |  | datetime_format                 | %Y-%m-%d %H:%i:%s              
&gt; |  | default_week_format             | 0                              
&gt; |  | delay_key_write                 | ON                             
&gt; |  | delayed_insert_limit            | 100                            
&gt; |  | delayed_insert_timeout          | 300                            
&gt; |  | delayed_queue_size              | 1000                           
&gt; |  | div_precision_increment         | 4                              
&gt; |  | engine_condition_pushdown       | OFF                            
&gt; |  | expire_logs_days                | 0                              
&gt; |  | flush                           | OFF                            
&gt; |  | flush_time                      | 0                              
&gt; |  | ft_boolean_syntax               | + -&gt;&lt;()~*:&quot;&quot;&amp;|                 
&gt; |  | ft_max_word_len                 | 84                             
&gt; |  | ft_min_word_len                 | 4                              
&gt; |  | ft_query_expansion_limit        | 20                             
&gt; |  | ft_stopword_file                | (built-in)                     
&gt; |  | group_concat_max_len            | 1024                           
&gt; |  | have_archive                    | NO                             
&gt; |  | have_bdb                        | NO                             
&gt; |  | have_blackhole_engine           | NO                             
&gt; |  | have_compress                   | YES                            
&gt; |  | have_crypt                      | YES                            
&gt; |  | have_csv                        | NO                             
&gt; |  | have_dynamic_loading            | YES                            
&gt; |  | have_example_engine             | NO                             
&gt; |  | have_federated_engine           | NO                             
&gt; |  | have_geometry                   | YES                            
&gt; |  | have_innodb                     | YES                            
&gt; |  | have_isam                       | NO                             
&gt; |  | have_merge_engine               | YES                            
&gt; |  | have_ndbcluster                 | NO                             
&gt; |  | have_openssl                    | NO                             
&gt; |  | have_ssl                        | NO                             
&gt; |  | have_query_cache                | YES                            
&gt; |  | have_raid                       | NO                             
&gt; |  | have_rtree_keys                 | YES                            
&gt; |  | have_symlink                    | YES                            
&gt; |  | hostname                        | server1                        
&gt; |  | init_connect                    |                                
&gt; |  | init_file                       |                                
&gt; |  | init_slave                      |                                
&gt; |  | innodb_additional_mem_pool_size | 1048576                        
&gt; |  | innodb_autoextend_increment     | 8                              
&gt; |  | innodb_buffer_pool_awe_mem_mb   | 0                              
&gt; |  | innodb_buffer_pool_size         | 8388608                        
&gt; |  | innodb_checksums                | ON                             
&gt; |  | innodb_commit_concurrency       | 0                              
&gt; |  | innodb_concurrency_tickets      | 500                            
&gt; |  | innodb_data_file_path           | ibdata1:10M:autoextend         
&gt; |  | innodb_data_home_dir            |                                
&gt; |  | innodb_doublewrite              | ON                             
&gt; |  | innodb_fast_shutdown            | 1                              
&gt; |  | innodb_file_io_threads          | 4                              
&gt; |  | innodb_file_per_table           | OFF                            
&gt; |  | innodb_flush_log_at_trx_commit  | 1                              
&gt; |  | innodb_flush_method             |                                
&gt; |  | innodb_force_recovery           | 0                              
&gt; |  | innodb_lock_wait_timeout        | 50                             
&gt; |  | innodb_locks_unsafe_for_binlog  | OFF                            
&gt; |  | innodb_log_arch_dir             |                                
&gt; |  | innodb_log_archive              | OFF                            
&gt; |  | innodb_log_buffer_size          | 1048576                        
&gt; |  | innodb_log_file_size            | 5242880                        
&gt; |  | innodb_log_files_in_group       | 2                              
&gt; |  | innodb_log_group_home_dir       | ./                             
&gt; |  | innodb_max_dirty_pages_pct      | 90                             
&gt; |  | innodb_max_purge_lag            | 0                              
&gt; |  | innodb_mirrored_log_groups      | 1                              
&gt; |  | innodb_open_files               | 300                            
&gt; |  | innodb_rollback_on_timeout      | OFF                            
&gt; |  | innodb_support_xa               | ON                             
&gt; |  | innodb_sync_spin_loops          | 20                             
&gt; |  | innodb_table_locks              | ON                             
&gt; |  | innodb_thread_concurrency       | 8                              
&gt; |  | innodb_thread_sleep_delay       | 10000                          
&gt; |  | interactive_timeout             | 28800                          
&gt; |  | join_buffer_size                | 131072                         
&gt; |  | key_buffer_size                 | 16384                          
&gt; |  | key_cache_age_threshold         | 300                            
&gt; |  | key_cache_block_size            | 1024                           
&gt; |  | key_cache_division_limit        | 100                            
&gt; |  | language                        |
&gt; /home/stephane/programs/mysql-5.0.45/install/share/mysql/english/  | 
&gt; | large_files_support             | ON                                
&gt; |  | large_page_size                 | 0                              
&gt; |  | large_pages                     | OFF                            
&gt; |  | lc_time_names                   | en_US                          
&gt; |  | license                         | GPL                            
&gt; |  | local_infile                    | ON                             
&gt; |  | locked_in_memory                | OFF                            
&gt; |  | log                             | ON                             
&gt; |  | log_bin                         | OFF                            
&gt; |  | log_bin_trust_function_creators | OFF                            
&gt; |  | log_error                       |
&gt; /home/stephane/programs/mysql/install/mysql.error.log              | 
&gt; | log_queries_not_using_indexes   | OFF                               
&gt; |  | log_slave_updates               | OFF                            
&gt; |  | log_slow_queries                | ON                             
&gt; |  | log_warnings                    | 1                              
&gt; |  | long_query_time                 | 10                             
&gt; |  | low_priority_updates            | OFF                            
&gt; |  | lower_case_file_system          | OFF                            
&gt; |  | lower_case_table_names          | 0                              
&gt; |  | max_allowed_packet              | 1047552                        
&gt; |  | max_binlog_cache_size           | 18446744073709551615           
&gt; |  | max_binlog_size                 | 1073741824                     
&gt; |  | max_connect_errors              | 10                             
&gt; |  | max_connections                 | 100                            
&gt; |  | max_delayed_threads             | 20                             
&gt; |  | max_error_count                 | 64                             
&gt; |  | max_heap_table_size             | 16777216                       
&gt; |  | max_insert_delayed_threads      | 20                             
&gt; |  | max_join_size                   | 18446744073709551615           
&gt; |  | max_length_for_sort_data        | 1024                           
&gt; |  | max_prepared_stmt_count         | 16382                          
&gt; |  | max_relay_log_size              | 0                              
&gt; |  | max_seeks_for_key               | 18446744073709551615           
&gt; |  | max_sort_length                 | 1024                           
&gt; |  | max_sp_recursion_depth          | 0                              
&gt; |  | max_tmp_tables                  | 32                             
&gt; |  | max_user_connections            | 0                              
&gt; |  | max_write_lock_count            | 18446744073709551615           
&gt; |  | multi_range_count               | 256                            
&gt; |  | myisam_data_pointer_size        | 6                              
&gt; |  | myisam_max_sort_file_size       | 9223372036854775807            
&gt; |  | myisam_recover_options          | OFF                            
&gt; |  | myisam_repair_threads           | 1                              
&gt; |  | myisam_sort_buffer_size         | 8388608                        
&gt; |  | myisam_stats_method             | nulls_unequal                  
&gt; |  | net_buffer_length               | 2048                           
&gt; |  | net_read_timeout                | 30                             
&gt; |  | net_retry_count                 | 10                             
&gt; |  | net_write_timeout               | 60                             
&gt; |  | new                             | OFF                            
&gt; |  | old_passwords                   | OFF                            
&gt; |  | open_files_limit                | 1024                           
&gt; |  | optimizer_prune_level           | 1                              
&gt; |  | optimizer_search_depth          | 62                             
&gt; |  | pid_file                        |
&gt; /home/stephane/programs/mysql/install/data/server1.pid             | 
&gt; | port                            | 3306                              
&gt; |  | preload_buffer_size             | 32768                          
&gt; |  | profiling                       | OFF                            
&gt; |  | profiling_history_size          | 15                             
&gt; |  | protocol_version                | 10                             
&gt; |  | query_alloc_block_size          | 8192                           
&gt; |  | query_cache_limit               | 1048576                        
&gt; |  | query_cache_min_res_unit        | 4096                           
&gt; |  | query_cache_size                | 0                              
&gt; |  | query_cache_type                | ON                             
&gt; |  | query_cache_wlock_invalidate    | OFF                            
&gt; |  | query_prealloc_size             | 8192                           
&gt; |  | range_alloc_block_size          | 2048                           
&gt; |  | read_buffer_size                | 258048                         
&gt; |  | read_only                       | OFF                            
&gt; |  | read_rnd_buffer_size            | 258048                         
&gt; |  | relay_log_purge                 | ON                             
&gt; |  | relay_log_space_limit           | 0                              
&gt; |  | rpl_recovery_rank               | 0                              
&gt; |  | secure_auth                     | OFF                            
&gt; |  | secure_file_priv                |                                
&gt; |  | server_id                       | 1                              
&gt; |  | skip_external_locking           | ON                             
&gt; |  | skip_networking                 | OFF                            
&gt; |  | skip_show_database              | OFF                            
&gt; |  | slave_compressed_protocol       | OFF                            
&gt; |  | slave_load_tmpdir               | /tmp/                          
&gt; |  | slave_net_timeout               | 3600                           
&gt; |  | slave_skip_errors               | OFF                            
&gt; |  | slave_transaction_retries       | 10                             
&gt; |  | slow_launch_time                | 2                              
&gt; |  | socket                          | /tmp/mysql.sock                
&gt; |  | sort_buffer_size                | 65528                          
&gt; |  | sql_big_selects                 | ON                             
&gt; |  | sql_mode                        |                                
&gt; |  | sql_notes                       | ON                             
&gt; |  | sql_warnings                    | OFF                            
&gt; |  | ssl_ca                          |                                
&gt; |  | ssl_capath                      |                                
&gt; |  | ssl_cert                        |                                
&gt; |  | ssl_cipher                      |                                
&gt; |  | ssl_key                         |                                
&gt; |  | storage_engine                  | MyISAM                         
&gt; |  | sync_binlog                     | 0                              
&gt; |  | sync_frm                        | ON                             
&gt; |  | system_time_zone                | MSK                            
&gt; |  | table_cache                     | 4                              
&gt; |  | table_lock_wait_timeout         | 50                             
&gt; |  | table_type                      | MyISAM                         
&gt; |  | thread_cache_size               | 0                              
&gt; |  | thread_stack                    | 131072                         
&gt; |  | time_format                     | %H:%i:%s                       
&gt; |  | time_zone                       | SYSTEM                         
&gt; |  | timed_mutexes                   | OFF                            
&gt; |  | tmp_table_size                  | 33554432                       
&gt; |  | tmpdir                          | /tmp/                          
&gt; |  | transaction_alloc_block_size    | 8192                           
&gt; |  | transaction_prealloc_size       | 4096                           
&gt; |  | tx_isolation                    | REPEATABLE-READ                
&gt; |  | updatable_views_with_limit      | YES                            
&gt; |  | version                         | 5.0.45-log                     
&gt; |  | version_comment                 | Source distribution            
&gt; |  | version_compile_machine         | x86_64                         
&gt; |  | version_compile_os              | unknown-linux-gnu              
&gt; |  | wait_timeout                    | 28800                          
&gt; | 
&gt; +---------------------------------+--------------------------------------------------------------------+ 225 rows in set (43.41 sec)
</pre>]]></description>
            <dc:creator>Stephane Eybert</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 25 May 2013 17:01:19 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,583905,583905#msg-583905</guid>
            <title>partitioning every year data (5 replies)</title>
            <link>http://forums.mysql.com/read.php?24,583905,583905#msg-583905</link>
            <description><![CDATA[ i am using mysql 5.6, i am trying to implement partition (by range) for my existing tables(planning to seperate the data's year wise!),but i am not able do it for the tables which is having primary key as well as foreign key? somehow i need to separate the data's for every year for the purpose of client restriction from old datas.! can anyone help me to fix this? or anyother alternative solution to handle these kind of scenarios,with steps?]]></description>
            <dc:creator>mohamed bashid s</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 02 May 2013 13:57:19 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,583901,583901#msg-583901</guid>
            <title>Sortable columns dilemma (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,583901,583901#msg-583901</link>
            <description><![CDATA[ I have an HTML table with about 10 sortable columns.  This table is basically reflected verbatim in a mysql table.  This table is composed of approximately 200,000 people, and can potentially grow to over a million.  The table can also be filtered by a given country, and all the columns are still sortable.  The only way I know how to handle these sorts quickly would be to add 20 indices, 10 for the regular table and 10 for the table filtered by country.<br />
<br />
The problem is, this table also has frequent updates, so adding all these indices is potentially a performance issue.  Every column that is sortable has data that is potentially updated frequently, so moving some data to another table doesn't seem like it would help.  <br />
<br />
I am not experienced with partioning, but I thought maybe that would be something useful for the country filter?  On the other hand, I don't know how that would really help the performance impacts to inserts/updates.<br />
<br />
So my question is, what's the right process to go through here and do I have any other options?  Should I just add all 20 indices and see how badly it affects the performance of inserts/updates?  I've learned a lot about mysql, but I'm by no means an expert.  I could really use some helpful advice here.<br />
<br />
I'm happy yo give more details as desired. :)]]></description>
            <dc:creator>Patrick Clas</dc:creator>
            <category>Performance</category>
            <pubDate>Sun, 14 Apr 2013 19:09:51 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,583647,583647#msg-583647</guid>
            <title>Insertion performance degrade with large index (3 replies)</title>
            <link>http://forums.mysql.com/read.php?24,583647,583647#msg-583647</link>
            <description><![CDATA[ Hi everyone,<br />
<br />
Recently, i found that one of the server have high I/O traffic on disk. The high I/O due to the writing of index on certain table after some diagnostics. I have done several evaluation test and  found that mysql take high number of write when inserting records to the table which have a large index.<br />
<br />
The Data type of indexed columns is varchar(15) and varchar(17) ,<br />
there is only 80 writes on disk if i load 20000 records to the table which has 10000 records whereas there are 1700 writes on disk when table grow to 20 millions (which got about 1 millions distinct values on indexed columns)<br />
even the number of records being inserted is the same.<br />
<br />
Engine is MyISAM.<br />
<br />
Increasing the size of the indexes also increasing number of write on disk per insert.<br />
<br />
Is it the BTREE index behavior  and how can i solve this issue?]]></description>
            <dc:creator>holy holy</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 13 Apr 2013 02:23:39 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,583422,583422#msg-583422</guid>
            <title>out of memory error (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,583422,583422#msg-583422</link>
            <description><![CDATA[ On 2 occasions (different days and times) I received this error in my logs<br />
<br />
130407 21:40:48 [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space<br />
<br />
<br />
My 64bit Sparc Solaris 8 server has 8G of memory, I have 5G of swap and ulimit is unlimited. I'm running 32bit mysql v5.0.22.  My connection is 1000 but this server hardly has any connections.  I&quot;m running innodb and some of the my.cnf settings are below.<br />
<br />
# ulimit -a<br />
time(seconds)        unlimited<br />
file(blocks)         unlimited<br />
data(kbytes)         unlimited<br />
stack(kbytes)        8192<br />
coredump(blocks)     unlimited<br />
nofiles(descriptors) 8192<br />
vmemory(kbytes)      unlimited<br />
<br />
key_buffer = 384M<br />
sort_buffer_size = 2M<br />
read_buffer_size = 2M<br />
query_cache_size= 32M<br />
innodb_buffer_pool_size = 384M<br />
innodb_lock_wait_timeout = 120 <br />
<br />
<br />
I do a top and mysqld is using about 4G of memory and it is not released until I restart mysql.  Why would it not release the memory?  How can I find out what query, etc, is running?  <br />
<br />
<br />
I read the great post from Rick James but I don't want to make changes until I see if I can find out why the memory is not being released.<br />
<br />
Any suggestions please?<br />
<br />
Thanks]]></description>
            <dc:creator>Christine Ross</dc:creator>
            <category>Performance</category>
            <pubDate>Tue, 09 Apr 2013 15:23:42 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,583097,583097#msg-583097</guid>
            <title>Mysql DB server hits 400% CPU (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,583097,583097#msg-583097</link>
            <description><![CDATA[ I  have been facing problem with my database server quite a month, Below are the observations that I see when it hits the top.<br />
<br />
 - load average 40 to 50<br />
 - CPU % - 400% <br />
 - idle % - 45%<br />
 - wait % - 11%<br />
 - vmstat procs r-&gt; 14 and b-&gt; 5 <br />
And then drains down within 5 minutes. And when I check the show processlist I see queries for DML and SQL are halted for some minutes. And it processes very slowly. Whereas each query are indexed appropriately and there will be no delay most of the time it returns less than 1 second for any query that are being executed to server the application.<br />
<br />
Mysql Version : 5.0.77<br />
OS : CentOS 5.4<br />
Mem: 16GB RAM (80% allocated to INNODB_BUFFER_POOL_SIZE)<br />
Database Size: 450 GB<br />
16 Processor &amp; 4 cores<br />
Not in per-table model.<br />
TPS ranges 50 to 200.<br />
Master to a Slave of the same configuration and seconds behind is 0.<br />
Below url shows show innodb status \G and show open tables; at the time spike. And this reduced within 5 minutes. Sometimes rare scenarios like once in two months I see the processes takes more than 5 to 8 hours to drain normal. All time I notice the load processor utilization and how it gradually splits its task and keep monitoring the process and innodb status and IO status. I need not do anything to bring it down. It servers the applications promptly and after some time it drains down to normal. Can you find anything suspicious in the url if any locks or OS waits any suggestion to initially triage with or what could have caused such spikes ?<br />
<br />
<a href="http://tinyurl.com/bm5v4pl"  rel="nofollow">http://tinyurl.com/bm5v4pl</a> -&gt; &quot;show innodb status \G and show open tables at DB spikes.&quot;<br />
<br />
Also there are some concerns that I would like to share with you.<br />
<br />
Recently I have seen a table that gets inserts only about 60 per second. It predominantly locks for a while waiting for auto-inc to get released. And thus subsequent inserts stays in the processlist tray. After a while the table gets IN_USE of about 30 threads and later I don't know what it makes to free them and clears the tray. (At this duration the load goes more than 15 for 5 minutes)<br />
<br />
Suppose if you say application functionality should be shapped to best suite the DB server to react. There are 3 to 5 functionalities each are independent entities in schema wise. Whenever I see the locks it gets affected to all other schemas too.<br />
<br />
Now what makes best fuzzy is the last one. I see slave keeps in synch with master with a delay of 0 second all time whereas slave has a single thread SQL operation that is passed from relay IO that which acts in FIFO model from the binary logs where Master had generated. When this single headed slave can keep the load less and have the operations upto-date, should the concurrent hits are really made to be concurrent for the functionalities which I assume making the possible IO locks in OS level. Can this be organized in application itself and keep the concurrent tenure density thinner?]]></description>
            <dc:creator>Mannoj Kumar</dc:creator>
            <category>Performance</category>
            <pubDate>Fri, 05 Apr 2013 15:41:33 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,582754,582754#msg-582754</guid>
            <title>4 GB RAM and runs so low the PC screams (9 replies)</title>
            <link>http://forums.mysql.com/read.php?24,582754,582754#msg-582754</link>
            <description><![CDATA[ Hello all.<br />
<br />
I have a massive problem with my localhost setup for developmental purposes.<br />
<br />
I run, at the present time, a community server 5.1 in 32 bit version on Windows 7 x64 with 4 GB RAM against a database to generate statistical lookup tables.<br />
<br />
While the process it self is extremely tedious and nearly absurdly slow regardless of which form of data input (be it load file... scriptet insert or triggers or other methods) the largest problem is that my system seems to run out of memory over night.<br />
<br />
In order to speed things up a bit I generated a basic LUT (lookup table) in the heap and calling on this to get the summary of rows to insert or discard for my final LUT.<br />
<br />
This is done in a stored procedure which defines basic criteria for selection and range limits.<br />
<br />
Upon starting the process I have first ensured to turn of any and all applications which are completely unused for this purpose.<br />
<br />
I initilize the whole thing with Windows then requiring 1,24 GB RAM for all processes in use.<br />
<br />
On loading the MEMORY based LUT I  specify MySQL should not use more than 256 MB RAM on init, the HEAP table is given a session limit of 2 MB (it is less than 256 kB in size) and then go to work.<br />
<br />
When I check on the processing in MySQL Administrator vers. 1.2.17 I see no particular problems in the logs or other places.<br />
<br />
By now the computer sounds like it's using 4 CPU cores att 100% but when checking the Windows 7 Performance Monitor MySQLD.exe is using 17-24 % (1 of 4 processor cores) and the memory usage is completely out of whack.<br />
<br />
Memory specs says<br />
<br />
HARDWARE RESERVED    2 MB<br />
USED              2566 MB<br />
MODIFIED           ~21 MB<br />
STAND BY         ~1503 MB<br />
FREE                 0 MB<br />
<br />
(CACHED 1527 MB)<br />
<br />
And yet I do call RESET QUERY CACHE or FLUSH TABLES approx. every 2*10^6 calls and have limited the cache not to store queries exceeding 1 MB.<br />
<br />
This as I noted it improved performance a little bit.<br />
<br />
If it means anything at all to the case above, the stored procedure I made performs a basic SELECT query on the memory heap table, processing (127^3)-1<br />
rows over (127^2)-1 times.<br />
<br />
Thus looping through (127^5)-1 rows to validate in memory before inserting those to be stored in 1 each of 17 different sub LUT tables on disk depending on internal values.<br />
<br />
If I at this point halt the MySQL server and restart from last known point I will only start over with the same set of memory usage if I also restart the Win 7 system completely.<br />
<br />
(Seems like the GC of Windows 7 leaves a lot to be desired!)<br />
<br />
Does anyone have any suggestions as to what other memory specific limits and tweaks can be applied to force Win 7 to actually dump unused cache memory so my PC can do something else besides traversing memory heaps?<br />
<br />
Any suggestions are welcome.]]></description>
            <dc:creator>Mike Jonsson</dc:creator>
            <category>Performance</category>
            <pubDate>Wed, 03 Apr 2013 02:45:47 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,582447,582447#msg-582447</guid>
            <title>Performance over Leased Line 10 Mbit (2 replies)</title>
            <link>http://forums.mysql.com/read.php?24,582447,582447#msg-582447</link>
            <description><![CDATA[ Hi!<br />
a question about running MySQL over a leased line. <br />
<br />
Being an admin, I have got into arguing with the SQL-Coders about pros and cons of moving the MySQL server to a hosting center connected by a leased line.<br />
<br />
Important to mention I am pro the relocation to hosting center while they are against.<br />
<br />
Let me describe the situation:<br />
<br />
Headquarters NOW: <br />
- 1 fat MySQL server (16 cores, 24 GB RAM)<br />
- ca. 30-50 MySQL clients connecting over LAN to the MySQL server<br />
<br />
Proposed change:<br />
- move the MySQL server to the hosting center<br />
- connected by a leased (dedicated) line: 10 Mbit, measured about 6-9 Mbit, Ping: ca. 15 ms<br />
- MySQL clients stay at headquarters, will connect by the leased line to the MySQL server<br />
<br />
The arguments brought against the change are:<br />
- sysbench delivers inside the LAN: <br />
     - 1900 transactions/s<br />
     - Ping: 1ms<br />
     - TX/RX: 100 Mbyte/s (= Gigabit LAN).<br />
<br />
On the other hand by using the leased line sysbench delivers:<br />
     - 75 transactions/s<br />
     - Ping: 15 ms<br />
     - TX/RX: 0,8 Mbyte /s (= 10 Mbit leased line)<br />
<br />
For exact results see below.<br />
<br />
While not being a DB expert I had a few looks at the MySQL server:<br />
<br />
- measuring NIC interface throughput in work hours: ca. 5 Gbyte / day<br />
<br />
- checking &quot;mysqladmin status&quot;:<br />
<br />
Uptime: 15736431  Threads: 62  Questions: 287203686  Slow queries: 11517  Opens: 594044  Flush tables: 1  Open tables: 64  Queries per second avg: 18.251<br />
<br />
- measuring the CPU Load (Linux) per day, we use Nagios: <br />
    - for ca. 8 hours: 1-1.5, <br />
    - for ca. 16 hours: mostly idling with a few peaks not reaching 0.25<br />
<br />
It seems for me as the MySQL coders ( they have coded the DB applications ) are comparing apples and oranges by bringing the argument of sysbench. My impresion is that the server is an idler with little network traffic.<br />
<br />
<br />
What do you think about the setup and are the sysbench comparisons meaningful? could it be that sysbench as it was used performs weak over the leased line, but their DB apps would perform with sufficient performance? I think about parallelization, asychronicity etc., sorry I am not a MySQL guru.<br />
<br />
Which other paramters I should measure on the existing server to make meaningful statements about whether the leased line of 10 Mbit is a viable solution?<br />
<br />
thanks!<br />
Peter<br />
<br />
PS:<br />
sysbench commands, that were used:<br />
<br />
--<br />
# prepare<br />
sysbench --test=oltp --oltp-table-size=1000000 --mysql-host=[host] --mysql-db=test --mysql-user=[user] --mysql-password=[password] prepare<br />
# run<br />
sysbench --test=oltp --oltp-table-size=1000000 --mysql-host=[host] --mysql-db=test --mysql-user=[user] --mysql-password=[password] --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run<br />
# cleanup<br />
sysbench --test=oltp --mysql-host=[host] --mysql-db=test --mysql-user=[user] --mysql-password=[password] cleanup<br />
--<br />
<br />
<br />
<br />
Results of SYSBENCH over 10 Mbit Leased Line:<br />
<br />
--<br />
sysbench 0.4.12:  multi-threaded system evaluation benchmark<br />
<br />
No DB drivers specified, using mysql<br />
Running the test with following options:<br />
Number of threads: 8<br />
<br />
Doing OLTP test.<br />
Running mixed OLTP test<br />
Doing read-only test<br />
Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)<br />
Using &quot;LOCK TABLES READ&quot; for starting transactions<br />
Using auto_inc on the id column<br />
Threads started!<br />
Time limit exceeded, exiting...<br />
(last message repeated 7 times)<br />
Done.<br />
<br />
OLTP test statistics:<br />
    queries performed:<br />
        read:                            63098<br />
        write:                           0<br />
        other:                           9014<br />
        total:                           72112<br />
    transactions:                        4507   (74.90 per sec.)<br />
    deadlocks:                           0      (0.00 per sec.)<br />
    read/write requests:                 63098  (1048.64 per sec.)<br />
    other operations:                    9014   (149.81 per sec.)<br />
<br />
Test execution summary:<br />
    total time:                          60.1711s<br />
    total number of events:              4507<br />
    total time taken by event execution: 480.4224<br />
    per-request statistics:<br />
         min:                                 83.83ms<br />
         avg:                                106.59ms<br />
         max:                                747.62ms<br />
         approx.  95 percentile:             291.07ms<br />
<br />
Threads fairness:<br />
    events (avg/stddev):           563.3750/9.14<br />
    execution time (avg/stddev):   60.0528/0.05<br />
<br />
--<br />
<br />
Results of SYSBENCH over Gigabit-LAN Line:<br />
<br />
--<br />
sysbench 0.4.12:  multi-threaded system evaluation benchmark<br />
<br />
No DB drivers specified, using mysql<br />
Running the test with following options:<br />
Number of threads: 8<br />
<br />
Doing OLTP test.<br />
Running mixed OLTP test<br />
Doing read-only test<br />
Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)<br />
Using &quot;BEGIN&quot; for starting transactions<br />
Using auto_inc on the id column<br />
Threads started!<br />
Time limit exceeded, exiting...<br />
(last message repeated 7 times)<br />
Done.<br />
<br />
OLTP test statistics:<br />
    queries performed:<br />
        read:                            1608922<br />
        write:                           0<br />
        other:                           229846<br />
        total:                           1838768<br />
    transactions:                        114923 (1915.29 per sec.)<br />
    deadlocks:                           0      (0.00 per sec.)<br />
    read/write requests:                 1608922 (26814.08 per sec.)<br />
    other operations:                    229846 (3830.58 per sec.)<br />
<br />
Test execution summary:<br />
    total time:                          60.0029s<br />
    total number of events:              114923<br />
    total time taken by event execution: 479.2058<br />
    per-request statistics:<br />
         min:                                  2.79ms<br />
         avg:                                  4.17ms<br />
         max:                                420.09ms<br />
         approx.  95 percentile:               5.17ms<br />
<br />
Threads fairness:<br />
    events (avg/stddev):           14365.3750/42.18<br />
    execution time (avg/stddev):   59.9007/0.00<br />
--]]></description>
            <dc:creator>Peter Konrady</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 28 Mar 2013 16:51:32 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,582384,582384#msg-582384</guid>
            <title>AUTO_INCREMENT PK best practices (1 reply)</title>
            <link>http://forums.mysql.com/read.php?24,582384,582384#msg-582384</link>
            <description><![CDATA[ Hello,<br />
<br />
Say I have a table with an 'id' column as AUTO_INCREMENT Primary Key. It is currently defined as a bigint (20). <br />
<br />
We have a lot of deletes/inserts to this table every day. I have a feeling that we would approach the max limit soon :(<br />
<br />
Is there a good way to deal with this problem? Rather than increasing the length of the column every time?<br />
<br />
Thanks,<br />
Venkatesh]]></description>
            <dc:creator>Venkatesh Iyer</dc:creator>
            <category>Performance</category>
            <pubDate>Thu, 28 Mar 2013 05:23:09 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,582327,582327#msg-582327</guid>
            <title>Problems encountered when testing with mysqlslap (no replies)</title>
            <link>http://forums.mysql.com/read.php?24,582327,582327#msg-582327</link>
            <description><![CDATA[ Hi, <br />
<br />
I was testing mysql server performance with mysqlslap. In the database there is a 'test' table with about 10,000 rows, and each row has a column 'id' as primary key and a column 'number' of type INT. <br />
<br />
Command I used to do the test:<br />
<br />
   mysqlslap -h localhost -uuser -ppassword --create-schema=myschema --concurrency=64 --number-of-queries=64 --iterations=2 --query=query.sql<br />
<br />
The problem was: <br />
when iterations=1, it was always fine, and the result is like the following:<br />
  Benchmark<br />
	Average number of seconds to run all queries: 0.016 seconds<br />
	Minimum number of seconds to run all queries: 0.016 seconds<br />
	Maximum number of seconds to run all queries: 0.016 seconds<br />
	Number of clients running queries: 64<br />
	Average number of queries per client: 1<br />
<br />
However, when iterations&gt;=2, the command hangs sometimes, and even if it doesn't hang, the query duration is substantially longer. An example of the result with iterations=2 is: <br />
  Benchmark<br />
	Average number of seconds to run all queries: 0.808 seconds<br />
	Minimum number of seconds to run all queries: 0.015 seconds //my comment: first iteration?<br />
	Maximum number of seconds to run all queries: 1.602 seconds<br />
	Number of clients running queries: 64<br />
	Average number of queries per client: 1<br />
<br />
The query (in query.sql) was simply 'SELECT * FROM test WHERE id=1000' where 1000 is a valid id. The mysql server is running on CentOS 6.3. <br />
<br />
Did I do anything wrong in the test? or is there a likely incorrect configuration of the mysql server?<br />
<br />
Thanks,<br />
Zhipan]]></description>
            <dc:creator>Zhipan Wang</dc:creator>
            <category>Performance</category>
            <pubDate>Mon, 25 Mar 2013 18:50:07 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,582118,582118#msg-582118</guid>
            <title>Mysql is very slow but using CPU &lt;10% (2 replies)</title>
            <link>http://forums.mysql.com/read.php?24,582118,582118#msg-582118</link>
            <description><![CDATA[ Mysql is very slow at about 9:00pm every day.The count of php-cgi.exe processes increases from 90 to 1000 quickly. And I have to close my website.<br />
But the CPU usage of mysql is just &lt;10%. What's wrong with mysql?]]></description>
            <dc:creator>Percy Xu</dc:creator>
            <category>Performance</category>
            <pubDate>Sun, 31 Mar 2013 07:25:01 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?24,582060,582060#msg-582060</guid>
            <title>Strange behavior with queries using &quot;limit&quot; (2 replies)</title>
            <link>http://forums.mysql.com/read.php?24,582060,582060#msg-582060</link>
            <description><![CDATA[ The following query takes 37 seconds to finish (This query gets the 50th post a user has made and the corresponding creation date)<br />
<br />
SELECT p.id, <br />
       (SELECT id <br />
        FROM   posts <br />
        WHERE  owneruserid = p.id <br />
        ORDER  BY creationdate <br />
        LIMIT  49, 1) AS post50id, <br />
       (SELECT creationdate <br />
        FROM   posts <br />
        WHERE  id = post50id) <br />
FROM   prol_users p <br />
WHERE  postcount &gt;= 50 <br />
whereas the following takes 30 minutes to finish (5th post)<br />
<br />
SELECT p.id, <br />
       (SELECT id <br />
        FROM   posts <br />
        WHERE  owneruserid = p.id <br />
        ORDER  BY creationdate <br />
        LIMIT  4, 1) AS post5id, <br />
       (SELECT creationdate <br />
        FROM   posts <br />
        WHERE  id = post5id) <br />
FROM   prol_users p <br />
WHERE  postcount &gt;= 50 <br />
Please notice that it is the first time I'm running the queries, so there's no caching involved. The only difference between the first query and 2nd is limit 49, 1 vs limit 4, 1<br />
<br />
Is there any reason why it takes lesser time when the query is limited to 50 rows than when it is limited to 5 rows?<br />
<br />
Explain output:<br />
<br />
--Note: The faster one, limit 50<br />
mysql&gt; explain select p.id, (select id from posts where owneruserid = p.id order by creationdate limit 49,1) as post50id, (select creationdate from posts where id = post50id) from prol_users p where postcount &gt;= 50;<br />
+----+--------------------+-------+--------+--------------------------+-----------------+---------+------------+--------+-----------------------------+<br />
| id | select_type        | table | type   | possible_keys            | key             | key_len | ref        | rows   | Extra                       |<br />
+----+--------------------+-------+--------+--------------------------+-----------------+---------+------------+--------+-----------------------------+<br />
|  1 | PRIMARY            | p     | ALL    | NULL                     | NULL            | NULL    | NULL       | 199026 | Using where                 |<br />
|  3 | DEPENDENT SUBQUERY | posts | eq_ref | PRIMARY                  | PRIMARY         | 4       | func       |      1 | Using where                 |<br />
|  2 | DEPENDENT SUBQUERY | posts | ref    | idx_owneruserid,idx_ouid | idx_owneruserid | 5       | jagat.p.id |     11 | Using where; Using filesort |<br />
+----+--------------------+-------+--------+--------------------------+-----------------+---------+------------+--------+-----------------------------+<br />
3 rows in set (0.00 sec)<br />
<br />
--Note: The slower one, limit 5<br />
mysql&gt; explain select p.id, (select id from posts where owneruserid = p.id order by creationdate limit 4,1) as post5id, (select creationdate from posts where id = post5id) from prol_users p where postcount &gt;= 50;<br />
+----+--------------------+-------+--------+--------------------------+------------------+---------+------+--------+-------------+<br />
| id | select_type        | table | type   | possible_keys            | key              | key_len | ref  | rows   | Extra       |<br />
+----+--------------------+-------+--------+--------------------------+------------------+---------+------+--------+-------------+<br />
|  1 | PRIMARY            | p     | ALL    | NULL                     | NULL             | NULL    | NULL | 199026 | Using where |<br />
|  3 | DEPENDENT SUBQUERY | posts | eq_ref | PRIMARY                  | PRIMARY          | 4       | func |      1 | Using where |<br />
|  2 | DEPENDENT SUBQUERY | posts | index  | idx_owneruserid,idx_ouid | idx_creationdate | 8       | NULL |      5 | Using where |<br />
+----+--------------------+-------+--------+--------------------------+------------------+---------+------+--------+-------------+<br />
3 rows in set (0.00 sec)<br />
<br />
Edit: I tested with various limit values and noticed that performance improves drastically when limit is changed from 9,1 to 10,1. In fact, the explain plan changes as well (to that of 50). Any insight on why it does so? Also, I added an index posts(owneruserid, creationdate) and there's no visible difference in performance.<br />
<br />
<br />
Note: I have posted this on StackOverflow and had a long discussion with some SO users, but it was of no avail. I'm posting here, hoping someone more acquainted with MySQL tuning would throw some light on it.<br />
<br />
Please have a look at the post here<br />
<a href="http://stackoverflow.com/questions/15555862/strange-mysql-query-performance"  rel="nofollow">http://stackoverflow.com/questions/15555862/strange-mysql-query-performance</a><br />
and the discussion here <br />
<a href="http://chat.stackoverflow.com/rooms/26670/discussion-between-cdhowie-and-jagat"  rel="nofollow">http://chat.stackoverflow.com/rooms/26670/discussion-between-cdhowie-and-jagat</a>]]></description>
            <dc:creator>Jagat P</dc:creator>
            <category>Performance</category>
            <pubDate>Sat, 23 Mar 2013 06:09:05 +0000</pubDate>
        </item>
    </channel>
</rss>
