Tuesday, 07 September 2010

Corporate Culture

 

Think!

Nearly all men can stand adversity, but if you want to test a man's character, give him power.

Abraham Lincoln (1809 - 1865)

Syndicate

Large MySQL databases

... don't work very well using the MyISAM table type. Corruptions and system lock-ups are a-plenty  when you have MyISAM tables with more than 1,000,000 records. The only  reason you would want to use MyISAM tables is to use the full-text searching functionality, and this feature is only marginally better than using the SQL 'like' statement.

Oh hell, my data is no more,
It all lies on the floor!
I used a cheap database,
And now I've lost some face.
MySQL is just such a chore!

If you are hosting millions of records and need any text-searching capabillity, then your data is probably worth more than the system itself. So go for a proper, but paid-for, RDBMS like Oracle, which also has excellent full-text searching capability.  "Don't spoil the boat for a ha'penny's worth of tar" as they say.

 
Product Quickcode Generator

How to generate a Base36 quickcode sequence using the SHA2 hash

 

This deterministic techique uses a hash of  the sequential Integer Id of an item to generate a typical product quickcode for it, as found in many shopping catalogues.

 

On a 'slowish' 2GHz machine it can generate 20,000 quickcodes per minute. The spread of the resulting quickcodes is near-perfectly even, which means that substrings of the quickcode can be used to construct a hashed directory tree for holding, for example, the huge amount of product image files associated with a product catalog. Using a hashed directory tree is a quick and efficient method to host millions of separate files for quick, random access, as most file systems only perform optimally with less than 1,000 contained in a directory.

 

Example of how a quickcode is generated from its primary key integer Id:

  • 1 => 8M9LFLN2

  • 2 => HZ40H3K0

  • 3 => 02LUJYQ2

  • etc.

 

You can download the Base36 Quickcode Generator test script, which demonstrates an implementation in Perl and MySQL

 

Read more...
 
How to Dedupe a table in MySQL

A quick and dirty way of stripping duplicate records out of a MySQL table!, if your table has no indexes or constraints:

 

Assuming the name of the offending table is customers:

CREATE TABLE customer_dedupe AS SELECT DISTINCT * FROM customers;
RENAME TABLE customers TO customers_dupe;
RENAME TABLE  customers_dedupe TO customers;

 Done!

 

But what if your original table had indexes?

Read more...
 
<< Start < Prev 1 2 3 4 5 6 Next > End >>

Results 1 - 4 of 21