Wednesday 25 April 2012

How to find how many processes are running in linux?

Hi Folks,

ps -ef | grep 'ipay4me_new'



here ipay4me_new is a text which is using in process url

Thanks

How to order field by its second character?

Hi All,

SELECT first_name, SUBSTR(first_name, 2) as first_name_sub FROM tbl_passport_application ORDER BY first_name_sub DESC;


Cheers!

How indexing impact on mysql table

############# BEFORE INDEXING ON datetime field ################
Total Records ared: 3299
EXPLAIN SELECT * FROM  `order_request_details` WHERE DATE(  `created_at` ) =  '2012-04-24'
5 Record found out of 3299
id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
1    SIMPLE    order_request_details    ALL    NULL    NULL    NULL    NULL    3372    Using where

EXPLAIN SELECT * FROM  `order_request_details` WHERE  `created_at` =  '2012-04-24'
No result
id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
1    SIMPLE    order_request_details    ALL    NULL    NULL    NULL    NULL    3136    Using where

EXPLAIN SELECT * FROM  `order_request_details` WHERE  `created_at` BETWEEN '2012-04-24' AND '2012-04-24';
No result
id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
1    SIMPLE    order_request_details    ALL    NULL    NULL    NULL    NULL    3533    Using where

EXPLAIN SELECT * FROM  `order_request_details` WHERE  `created_at` >= '2012-04-24:00:00:00' AND  `created_at` <= '2012-04-24:23:23:59';
5 Record found out of 3299
id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
1    SIMPLE    order_request_details    ALL    NULL    NULL    NULL    NULL    3237    Using where


############# AFTER INDEXING ON datetime field ################

EXPLAIN SELECT * FROM  `order_request_details` WHERE DATE(  `created_at` ) =  '2012-04-24'
5 Record found out of 3299
id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
1    SIMPLE    order_request_details    ALL    NULL    NULL    NULL    NULL    3327     Using where


EXPLAIN SELECT * FROM  `order_request_details` WHERE  `created_at` >= '2012-04-24:00:00:00' AND  `created_at` <= '2012-04-24:23:23:59';
5 Record found out of 3299
id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
1    SIMPLE    order_request_details    ALL    NULL    NULL    NULL    NULL    5    Using where