Archive

Posts Tagged ‘php’

How to Update Millions of MySQL records from Table A to Table B

April 17th, 2009

Recently I am working on a project where I will need to convert client’s database with millions of old Paradox/Foxpro records to MySQL and then I have to create a new Web App based on PHP/MySQL to deal with all this old records plus new way of database structuring.

When I am trying to update a customer ID from a table A to table B, I always need to wait for few hours for the server to process it. This is so annoying and waste of time.

Finally I found the answer today where actually I need to INDEX the customer ID before doing the updates. The difference is just so BIG.

With the same command issue at the following, without INDEX it will takes hours to complete BUT after INDEXING then it just need 1.45 sec for 19,638 records!!!

UPDATE tel AS t INNER JOIN contact AS c  SET t.cid = c.cid WHERE t.addr_id = c.addr_id AND t.cid = 0;
Query OK, 19638 rows affected (1.45 sec)
Rows matched: 19638  Changed: 19638  Warnings: 0

So, now I just perform the update again for full data and let’s see the results ;)

UPDATE tel AS t INNER JOIN contact AS c  SET t.cid = c.cid WHERE t.addr_id = c.addr_id;
Query OK, 0 rows affected (3.55 sec)
Rows matched: 103484  Changed: 0  Warnings: 0

That’s why I say it’s fun to play with web programming now a days ;) lol

  • Share/Save/Bookmark

admin Programming , , , ,

is your Web Server hacked to be a SPAM server?

June 16th, 2008

This morning I just found that my cPanel server sent me a notice by email saying there is a new uploaded CGI/script file trying to use the sendmail function. The file is data_.php

This related to one of my website that I have not been updating recently, so I quickly ftp into my server and check it.

I found that this data_.php script is use for GETTING HTTP POSTS from some where and then it will MAIL it out, so, my server will become the email server for the SPAMMER. Luckily I notice about it earlier now and saw this stupid spammer write different php style than me, so I can sure this is not the script that I wrote for myself (lol, I have to deal with thousand of scripts always)

I have report this to the datacentre admin, they are checking for me now that whether where is the security hole. Stay tuned!!

  • Share/Save/Bookmark

boyd Internet, Programming , , , , , ,