Jason Lee
  • Home
  • Github
Sign in Subscribe

mysql

A collection of 3 posts
mysql

Mysql Index 和 Where 順序的關聯

我們假設我們有建立一個 table, 裡面有三個欄位,分別為 a, b, c, 同時也針對這三個欄位建立 index idx_abc,這種建法背後其實是同時建立三個 index, 類似 idx_a, idx_ab, idx_abc , 這是時候我們分別用下面條件來查詢,那些會觸發 index? 因為我們的 index 建立順序是 abc 一起的複合 index, 所以要觸發這個 index, 裡面必須要 a 這個欄位,因為需要 index 的第一個欄位,因為 mysql 的 sql parse 有針對查詢做最佳化,當你的 where 條件第一個開始的不是 a 但後面有用到 a, 這樣也是會用到
Feb 10, 2020 1 min read
mysql

修改 mysql max_connections 的值

1. Check max_connections Value mysql> SHOW VARIABLES LIKE "max_connections"; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 150 | +-----------------+-------+ 1 row in set (0.00 sec) 2. Increase max connection number SET GLOBAL max_connections = 2000; 3. disable query_cache set global query_cache_type=0;
Nov 27, 2016
mysql

Mysql 運維常用指令

1. Database size SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema ; 2. Show all indexs for a table SHOW INDEX FROM yourtable; 3.
Nov 27, 2016 1 min read
Page 1 of 1
Jason Lee © 2025
Powered by Ghost