標籤:索引 mysql 最佳化 sql 前情提要 : 需求就是一個普通的兩個表串連從而查詢出詳細資料。其中A表是大表, 測試資料都有數萬條; B表是小表大概1000多條資料。1. 為了趕工寫出的未最佳化SQL(為突出主題, 返回欄位用 * 代替不寫出詳細欄位, WHERE條件也去掉了):SELECT * FROM A a
標籤:linux mysql 1.下載、安裝 MySQL :[[email protected]~]# cd /usr/local/src[[email protected]]# wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz[[email protected]]#
標籤: 兩種方式: 第一種: 先各自排序,然後通過暫存資料表嵌套再合并結果,注意排序後面必須加入 limit,否則order by不起作用 SELECT * FROM (SELECT * FROM t1 WHERE id IN (1,3,6) ORDER BY utime DESC limit 5) AS a UNION ALL SELECT * FROM (SELECT * FROM t1 WHERE id IN (2,4,5) ORDER BY utime DESC
標籤:http://dev.mysql.com/doc/refman/5.6/en/memory-use.html The following list indicates some of the ways that the mysqld server uses memory. Where applicable, the name of the system variable relevant to the memory use is given:All threads share
標籤:轉載請註明出處:http://blog.csdn.net/guoyjoe/article/details/44836547一、在源碼安裝的基礎上:我打了一個tar包:cd /u01/myss06tar cvzf my3306.tar .二、關閉防火牆chkconfig iptables off service iptables stop vi /etc/selinux/configSELINUX=disabled三、檢查作業系統上是否安裝了MySQL[[email
標籤:在使用mysql時,有時需要查詢出某個欄位不重複的記錄,雖然mysql提供有distinct這個關鍵字來過濾掉多餘的重複記錄只保留一條,但 往往只用它來返回不重複記錄的條數,而不是用它來返回不重記錄的所有值。其原因是distinct只能返回它的目標欄位,而無法返回其它欄位,經過實驗, 有如下方法可以實現。舉例如下:這是test表的結構id test1 test21 a 12 a 23 a 34 a 15 b 16 b 27 b 38 b