跳到主要內容

發表文章

目前顯示的是有「MySQL」標籤的文章

MySQL -- Truncate Table

通常清除Table內的所有資料採用 Delete SQL命令的做法並不好,除了效率不好之外另外也可能造成過度使用系統資源,因此DBCS都會提供快速刪除資料的方式 MySQL在5.03版之前,InnoDB Truncate採用 Row by Row方式刪除每一筆資料 5.0.3之後除非Table本身有Foreign Key參考到本table是採用Row by Row方式刪除資料 若無Foerign Key的話則採用 Fast-Truncate方式( Drop & Re-create )重建新 Table 並且會 Reset AUTO_INCREMENT 計數器 而在5.0.13版本之後無論是否採用 Fast-Truncat都會重置 AUTO_INCREMENT 計數器 ** Trigger注意事項 Truncate 若不採用Delete SQL Command 因此並不呼叫任何 ON DELETE Trigger

MySQL Virtualization Performance Issues

Often the biggest consideration is the performance of a virtualized environment once hosted. In most cases, the virtualized environment involves some level of emulation of one or more of the hardware interfaces (CPU, network or disk) of the host environment. The effect is to reduce the effective performance of the virtualized environment compared to running an application natively on the host. Some core resourcing issues to be aware of include: •Using virtualization does not reduce the amount of CPU required to support a particular application or environment. If your application stack requires 2GB of RAM on an individual machine, the same RAM requirement will apply within your virtualized environment. The additional overhead of the virtualization layer and host operating system or environment often mean that you will need 2.5GB or 3GB of RAM to run the same application within the virtualized environment. You should configure your virtualization environment with the correct RAM allocati...

MySQL HA 建議

MySQL 的High Availability 設計參考資訊 Requirements MySQL Replication MySQL Replication + Heartbeat MySQL Heartbeat + DRBD MySQL Cluster MySQL + memcached Availability Automated IP failover No Yes Yes No No Automated database Failover No No Yes Yes No Typical failover time User/script-dependent Varies < 30 seconds < 3 seconds App dependent Automatic resynchronization of data No No Yes Yes No Geographic redundancy support Yes Yes Yes, when combined with MySQL Replication Yes, when combined with MySQL Replication No Scalability Built-in load balancing No No No Yes Yes Supports Read-intensive applications Yes Yes Yes, when combined with MySQL Replication Yes Yes Supports Write-intensive applications No No Yes Yes No Maximum number of nodes per group One master, multiple slaves One master, multiple slaves One active (primary), one passive (secondary) node 255 Unlimited Maximum number of slaves Unlimited (reads only) Unlimited (reads only) One (failover only) Unlimited (reads only) Unlimite...

MySQL 5.4發展

MySQL 5.4主要是以 5.1版的核心為主要架構,再針對特殊應用加以修改或是補強功能設定 以下是我個人比較關注的部分 架構調整與改進 5.4最主要是針對多核心系統加以改進,以往要增進MYSQL的執行速度都過於仰賴 CPU Clock Speed 提升效能,現今的主機都以 Multi-Core 為主要架構,因此5.4版便是針對Multicore架構做調整,增進 mySQL的執行效能,使mySQL可以充分利用SMP系統 增進的部分主要針對 InnoDB 的locking,記憶體管理與執行緒同步管理問題 的增進 後續會將 5.4使用心得更新到本部落格