June 19, 2013

Post: A micro-benchmark of stored routines in MySQL

… fast stored routines are in MySQL? I just ran a quick micro-benchmark to compare the speed of a stored function against… then executing the subquery for each row: mysql> explain select ….\G *************************** 1. row *************************** id: 1 select_type: PRIMARY table: ci type: ALL possible….Code = c; > return res; > end// mysql> delimiter ; Now the query can be rewritten as this: mysql> select sql_no_cache sum(ci.Population…

Post: Talking MySQL to Sphinx

… | 2735703 | 139448919 | 2735703 | +————+——–+———-+———–+———+ 10 rows in set (32.47 sec) MySQL mysql> select max(forum_id) as m,author_id as a from… select max(author_id) as a ,forum_id as f from sptest where num_links=1; Empty set (2.70 sec) MySQL mysql> select… cores and multiple nodes in the system. The raw scan speed was almost 10 millions of rows per second (this is…

Post: InnoDB Full-text Search in MySQL 5.6 (part 1)

…. At the very bottom, the page claims that you can speed up bulk loading into an InnoDB FT index by declaring… the following statements: mysql> insert into dir_test_innodb3 (fts_doc_id, full_name) values (1, ‘john smith’); mysql> select * from dir_test… what happens: mysql> set global innodb_ft_aux_table=’test/dir_test_innodb’; mysql> set global innodb_optimize_fulltext_only=1; mysql> select * from…

Post: MySQL Indexing Best Practices: Webinar Questions Followup

SELECT * FROM TBL WHERE hash=crc32(‘string’) AND string=’string’ The other thing you need to consider is string comparison in MySQL… key significantly fragmented. I also would note there are some MySQL optimizer restrictions in how well it can deal with primary… but my query is only selecting on vendor, will the index have any impact on the speed of the query? A: If…

Post: Speeding up GROUP BY if you want aproximate results

… in the database so It was pretty simple query: select sum(cnt) from (select count(*) cnt from performance_log_080306 group by… could trick MySQL to do group by a hash of the page instead of page itself: mysql> select sum(cnt) from (select count(*) cnt… just limit it to first number of rows: mysql> select avg(length(page)) from (select page from performance_log_080306 limit 10000) tmp…

Post: Upgrading MySQL

… application which uses simple MySQL functionality which is unlikely to be affected. If you’re something like SELECT name FROM users WHERE… to run comparison. The tool will run SELECT queries on both new and old MySQL installations and check result set, explain plan… of queries with good speed is not enough. You also need to perform stress testing to ensure both MySQL does not crash…

Post: Recovery deleted ibdata1

… Max checkpoint age 7782360 To speed up flushing we can set dirty pages percentage to zero: mysql> set global innodb_max_dirty… last transaction wasn’t something that requires a purge operation (SELECT for example) Trx id counter will be bigger. In that…/lib/mysql# And restart MySQL: root@localhost:/var/lib/mysql# /etc/init.d/mysql restart After the restart all InnoDB tables are reachable: mysql> select count…

Post: Three ways to know when a MySQL slave is about to start lagging

… at 2x speed.) Three: measure it more scientifically. Use our patched server, which gives you a USER_STATISTICS table. mysql> SELECT * FROM INFORMATION_SCHEMA.USER_STATISTICS WHERE USER=’#mysql_system#’\G *************************** 1. row *************************** USER: #mysql_system# TOTAL_CONNECTIONS: 1…

Post: Should we give a MySQL Query Cache a second chance ?

… is appealing to improve performance for MySQL Applications ? Make it Lockless Can we re-implement MySQL Query Cache so it is lockless… applications in MySQL have very large number of queries doing updates through primary key and use primary key for selects. I believe… compress results at faster than wire speed for 1Gb networks. Plus if we can get MySQL protocol to support such light compression…

Post: MySQL Query Cache

… “Query Cache” which is quite helpful for MySQL Performance optimization tasks but there are number … queries being cached this might reduce update speed a bit. Fragmentation over time – Over time …cache efficiency. First looking at number of your selects – Com_select and see how many of them are…