Author Archives: admin

A few mysql handy commands and useful tips to optimize speed

Show table schema and execution plan:
show create table
explain select

Index manipulation:
show index on
drop index on
create index on

show the running process:
show processlist

Also from stackoverflow:

Do you have an index on key_1?

Without it, each query by itself will already be slow just looking for 123.
Do you have an index on (key_1, key_2)?

Because select distinct key_2 where key_1 = 123 is really fast if it can get all the necessary data from the index alone. No need to access the table.
Are the rows/indexes fixed-size?

Traversing a fixed-size table/row can be faster because one always knows where the x-th record is by just calculating the offset. Variable row sized tables are slower.
Have you tried adding an autoincrement surrogate primary key?

Indexes work way better when all they have to store is the column, and a small primary key. Composite primary keys are slower.
Did you consider a read-only table?

You can pack myisam table for fast access, but they become read-only. It’s a hack that has its uses though.
One step further, have you considered a datawarehouse?

If the tables don’t change often, it might be best to duplicate the information for fast access.

Can you post a show create table statement? Seeing the columns and indexes would help. Can you post an explain select statement? Seeing which indexes are used would help.

Join mp4 files with mp4box

First of all need a linux system, if you have a windows try to find a windows version of mp4box
On ubuntu, install the package that contains mp4box:
aptitude install gpac
then run the command like this to join or merge the mp4 files
MP4Box -cat path/to/video1.mp4 -cat path/to/video2.mp4 -cat path/to/video3.mp4 -new path/to/output.mp4

disable ipv6 address on linux or linode

if you want to remove ipv6 address run the below command:
sysctl -w net.ipv6.conf.all.autoconf=0
sysctl -w net.ipv6.conf.eth0.autoconf=0
sysctl -w net.ipv6.conf.all.accept_ra=0

to make it permanently add it to the sysctl.conf

Also on Debian Etch (probably on newer too), without setting the accept_ra, the system will autoconfigure using the Link local adress (fe80..)

Further more, automatic address configuration and router discovery will be disabled if the host itself is a router and accept_ra is not 2, i.e
net.ipv6.conf..accept_ra=0 or net.ipv6.conf..accept_ra=1.


enable virutal memory on linux debian

Most of the time, virtual memory is enabled by default on linux, in case it’s not there, run below commands:
cd /var
touch swap.img
chmod 600 swap.img
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab

And you can use this command to check for memory status:

All-In-One Video Downloader

Download below and start to use it now. Also feel free to leave comment below.

All-In-One Video Download can download video from almost every video sites from internet. For example, not only it can download from youtube, it will also be able to download from vimeo, dailymotion and many more.

You don’t have to know exactly what sites it support, when you feel need to download a video, just paste in the url and start the download button, most of time, it will be able to download it successfully for you.


All-In-One Video Downloader

Download below and start to use it now. Also feel free to leave comment below.