June 18, 2013

Post: GROUP_CONCAT useful GROUP BY extension

GROUP_CONCAT(client_id) FROM services WHERE id = 3 GROUP BY id; +—-+————————-+ | id | GROUP_CONCAT(client_id) | +—-+————————-+ | 3 | 5,6,7 | +—-+————————-+ Handling in PHP: old way: with group_concat

Post: Flexviews - part 3 - improving query performance using materialized views

… aggregate functions supported, except GROUP_CONCAT and AVG(distinct)….statements representing the original SQL statements. Each MV name will be taken from the table name specified in each statement. You should try each statementin the data dictionary: mysql> select * from flexviews.mview_table where

Post: Advanced index analysis with mk-index-usage

in more flexible ways. The default report just prints out ALTER statementsmysql> SELECT CONCAT_WS(‘.’, db, tbl, idx) AS idx, -> GROUP_CONCAT(alt_idx) AS alternatives, -> GROUP_CONCAT

Post: Quickly finding unused indexes (and estimating their size)

…COLUMN_CNT, group_concat( i.column_name order by SEQ_IN_INDEX …_name) where t.table_schema like ‘sakila%’ group by t….in set (0.02 sec) From here I can use some clever SQL to generate the precise ALTER TABLE statements… sizing information in the all_indexes view: mysql> select * from all_indexes\G ……

Post: Dropping unused indexes

statements automatically. I also made it to look only at tables which were accessed: mysql> select concat(‘alter table ‘,d.table_schema,’.',d.table_name,’ drop index ‘,group_concat…_NAME=iz.INDEX_NAME) WHERE iz.TABLE_SCHEMA IS… against using it blindly in production. It is possible…