Checking out phpMyAdmin with SVN

October 27, 2006 at 1:48 pm

This is more a reminded to myself than anyone else, but as of this posting you can get the latest version of phpMyAdmin via SVN:

svn checkout https://svn.sourceforge.net/svnroot/phpmyadmin/tags/STABLE/phpMyAdmin phpMyAdmin-stable

Removing Duplicate Rows in MySQL

September 14, 2006 at 12:36 pm

I know you, programmer. Sometimes even you- the most gifted of all programmers to ever place their hands on a keyboard- makes a mistake. Maybe you have a script that inserts into a database and that script steps on itself and for some unexpected reason your mechanism for making sure that doesn't happen fails.  So what do you do when you are left with thousands of duplicate rows in a MySQL database?

Well, you could hire a college intern or someone from Manpower to manually delete all the rows.  About a thousand dollars and a week later, you realize that they too can make mistakes, and about twenty important records are missing from your database.  Then your boss comes to you and says, "So, Mr. Genius programmer, where did so-and-so's personal account information go?"  Damn you Manpower!

That said, here's a quick and easy way to remove duplicates from a MySQL database. Make sure you execute it all at once, and make sure you backup your duplicated garbage table before hand.

CREATE TEMPORARY TABLE tblTempDoopless like tblWithDoops;

INSERT INTO tblTempDoopless(pkID, strField1, strField2)
    SELECT pkID, strField1, strField2
    FROM tblWithDoops
    GROUP BY strField1;  /* this is the field that is duplicated! */

DELETE FROM tblWithDoops;

INSERT INTO tblWithDoops(pkID, strField1, strField2)
    SELECT pkID, strField1, strField2
    FROM tblTempDoopless;

Also, note the group by. Weird how that works. As long as you're not using concat, all the other columns seem to be the first row MySQL finds.

Alternatives to Built-In MySQL FullText Search

August 4, 2006 at 2:20 pm

Searching the communities might be a trivial task at the moment, but as our data grows, we'll require a more robust utility to handle the processing of many concurrent searches.  I've been researching these tools, and I came across a pretty awesome discussion between several big players in the open-source searching "business".

Take a look:
http://www.mysqlperformanceblog.com/2006/06/26/full-text-search-for-all-mysql-storage-engines/