June 20, 2013

Post: How fast is FLUSH TABLES WITH READ LOCK?

lock, anything else that currently holds the lock must finish what it’s doing. That means that every currently running query, including SELECT queries

Post: MySQL Query Cache

… using query_cache_wlock_invalidate=ON locking table for write would not invalidate query cache so you can get results even if table is locked and… comments in the query, have extra space or use different case – these would be different queries for query cache. Only SELECT queries are cached SHOW…

Post: Slow DROP TABLE

Query | 7 | rename result table | ALTER TABLE large_table ENGINE=MyISAM | | 679 | root | localhost | test | Query | 6 | Opening tables | select * from other_table

Post: Resyncing table on MySQL Slave

…: Assuming your table schema does not change you can do something like this on the master: LOCK TABLE tbl WRITE; SELECT * FROM table INTO OUTFILE ‘/tmp/tbl.txt’; DELETE FROM tbl; LOAD DATA INFILE ‘tmp/tbl.txt’ INTO TABLE tbl; UNLOCK TABLEStable rep to rep_maint; Query OK, 0 rows affected (0.01 sec) mysql> select * from rep_maint into outfile ‘/tmp/rep.txt’; Query

Post: Index lock and adaptive search - next two biggest InnoDB problems

… key select queries and write queries at the same time. InnoDB again uses single global mutex for adaptive_search (single mutex for ALL table and ALL indexes), so write query blocks ALL select queries. Usually first action is to disable…: I think some hashing algorithms may be applied to not lock select queries. We may look how to implement it. Until that InnoDB…

Post: PHP Large result sets and summary tables.

… cause things breakage Table LocksTable locks are not cleared until you fetch whole result set if you’re reading from tables directly (if you… if you need to query all result at once. It is rather efficient bur can cause problems with table locks and other issues… queries to process data by certain objects (ie City by one City at the time) or do INSERT … SELECT to the temporary table

Post: MySQL optimizer: ANALYZE TABLE and Waiting for table flush

… running query – Run an ANALYZE TABLE on a table accessed by the long running query So first we need a long running query against table t: SELECT… reopen it using FLUSH. Therefore the table will be locked until all queries that are using that table finish. There are only two solutions…

Post: Analyzing Slow Query Table in MySQL 5.6

…longlong query_time= (longlong) (query_utime/1000000); 611 longlong lock_time= (longlong) (lock_utime/1000000); All the times recorded in slow query log tables are rounded… SELECT CONCAT( ‘# Time: ‘, DATE_FORMAT(start_time, ‘%y%m%d %H:%i:%s’), CHAR(10), ‘# User@Host: ‘, user_host, CHAR(10), ‘# Query

Post: Slow Query Log analyzes tools

queries before queries are executed (and even parsed) so it can’t contain query execution information such as execution and lockqueries but hurt others, for example adding indexes often help SELECT queries

Comment: SELECT LOCK IN SHARE MODE and FOR UPDATE

…->db->query(‘SET AUTOCOMMIT=0′); $this->db->query(“LOCK TABLES hotels READ, location WRITE”); $this->db->query(“SELECT hotel_id FROM hotels WHERE hotel_id = 1 “); $query = $this->db->get(); $this->db->query