June 20, 2013

Post: Possible optimization for sort_merge and UNION ORDER BY LIMIT

mysql> explain (select * from utest where c1=5) union (select * from utest where c2=5) order by ord desc limit 10 \G *************************** 1. row *************************** id: 1 select_type: PRIMARY table

Post: InnoDB Full-text Search in MySQL 5.6: Part 2, The Queries!

table which was an integer PK, and in anothertable=’test/innodb_ft_list2′; Query OK, 0 rows affected (0.00 sec) mysql: INSERT INTO innodb_ft_list2 SELECT * FROM

Post: Talking MySQL to Sphinx

1 | 2558807 | | 6739300695 | 1 | 208215 | | 6739297111 | 1 | 2736471 | | 6739296855 | 1 | 2736471 | +————+——–+———-+ 10 rows in set (7.92 sec) MySQL mysql> select forum_id as f from sptest order by

Post: Join Optimizations in MySQL 5.6 and MariaDB 5.5

MySQL always uses Nested Loop Join to join two or more tables. What this means is that, select rows from first table… on col1 would be sorted by col1 i.e. … close, yet slower by ~10s. Another thing that is important…Select_scan 1 1 1 1 1 1 Sort_scan 1 1 1 1 1 1 The first obvious improvement is shown by

Post: Using index for ORDER BY vs restricting number of rows.

mysql> explain select * from goods where cat_id=5 and seller_id=1 order by price desc limit 10 \G *************************** 1. row *************************** id: 1 select_type: SIMPLE table… of rows. Another interesting technique is to use sphinx search to accelerate sorting and retrieval which …

Post: When the subselect runs faster

1 | SIMPLE | table | index | NULL | PRIMARY | 4 | NULL | 549117 | Using where | +—-+————-+——-+——-+—————+———+———+——+——–+————-+ mysql> select * from table FORCE INDEX(PRIMARY) where (col1=’A'||col1=’B') order by

Post: High-Performance Click Analysis with MySQL

…advance. What about partitioning in MySQL 5.1?  I know … often justified by a large reduction in table size. I sort of stumbled…tables is hard work for the database server.  If you do it on the master with INSERT..SELECTMySQL can’t handle too many of those at once. Aside from star schemas, another

Post: The Optimization That (Often) Isn't: Index Merge Intersection

…they are all straightforward to implement. The bad (sort of) news is that each situation is… permanent solution. Another option is, of course, to change the indexing on the table. For instance, … parent_id=0 AND status=1 ORDER BY user_id LIMIT 1; mysql> EXPLAIN SELECT user_id FROM users USE INDEX(user…

Post: Using any general purpose computer as a special purpose SIMD computer

…. Love one another and let…table words2 partition by hash(bucket) partitions 12 as select id % 6 bucket, chars words fromby the native database interface (MySQL): mysql> select word, md5(word), md5(reverse(word)), count(*) from words2 group by 1,2,3 order by 3,1… necessary. When sorting or grouping …

Post: Edge-case behavior of INSERT...ODKU

MySQLtable: (root@localhost) [test]> select * from update_test; +————+———-+———+———————+ | id | username | host_id | last_modified | +————+———-+———+———————+ | 1