Posts Tagged "performance"

InnoDB is red hot, MyISAM not

Planet MySQL

via InnoDB is red hot, MyISAM not.

Everyone who started using MySQL before 5.5 started off with MyIsam. It was the default storage engine and you had to go out of your way to use anything else. It was a good looking database, rugged…

MySQL Query to get Data, Index and Table Size by Storage Engines

SELECT IFNULL(B.engine,’Total’) “Storage Engine”, CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),’,’,”),17,’ ‘),’ ‘,SUBSTR(‘ KMGTP’,pw+1,1),’B’) “Data Size”, CONCAT(LPAD(REPLACE(FORMAT(B.ISize/POWER(1024,pw),3),’,’,”),17,’ ‘),’ ‘,SUBSTR(‘ KMGTP’,pw+1,1),’B’) “Index Size”, CONCAT(LPAD(REPLACE(FORMAT(B.TSize/POWER(1024,pw),3),’,’,”),17,’ ‘),’ ‘,SUBSTR(‘ KMGTP’,pw+1,1),’B’) “Table Size” FROM (SELECT engine,SUM(data_length) DSize,SUM(index_length) ISize,SUM(data_length+index_length) TSize FROM information_schema.tables WHERE table_schema NOT IN (‘mysql’,’information_schema’) AND engine IS NOT NULL GROUP BY engine WITH ROLLUP) B,(SELECT 3 pw) A ORDER BY TSize;

Sample Report:

MyISAM 0.031 GB 0.013 GB 0.044 GB
InnoDB 0.599 GB 0.471 GB 1.069 GB
Total 0.630 GB 0.484 GB 1.113 GB

How to downgrade PHP to 5.2 on Ubuntu?

Here is a quick script to do this task:

Courtsey of Stijn Beauprez from here:

#! /bin/sh
php_packages=`dpkg -l | grep php | awk ‘{print $2}’`

sudo apt-get remove $php_packages

sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

sudo mkdir -p /etc/apt/preferences.d/

for package in $php_packages;
do echo “Package: $package
Pin: release a=karmic
Pin-Priority: 991
” | sudo tee -a /etc/apt/preferences.d/php

sudo apt-get update

sudo apt-get install $php_packages

To undo the script and upgrade to php 5.3 you will need to delete the file (sudo rm /etc/apt/preferences.d/php), run sudo apt-get update, and then sudo apt-get dist-upgrade which will get the latest packages for your distribution, including the PHP packages. (Ben Holt)

One mod deflate filter to rule them all …

Add the following code to your .htaccess file to automatically have all of your text files compressed by mod-deflate on the fly.

Warning: Make sure you are running Apache 2.0 server with Mod Deflate enabled.

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/javascript text/javascript text/css application/xml

All in one line.