A Day At The Office
One of my past project was to develop a double-entry system which compare the same record entered by two different staff. Recently, the client complained about the system being painfully slow. My colleagues blame the helper function that do the comparison. I removed the view so the is no comparison running (the controller is basically tell the model to find all record and pass the results back to view). Even so, the system is still slow. Somehow I was convinced that this is the database-level problem not my software.
Armed with phpmyadmin, I ran a simple find operation that retrieve the first two records in the main table (there are 30k of rows in there). It took a quite long time (seems live forever to me) for mysql to get the results. I wasn’t sure what the problem was, but I was glad that my software wasn’t the culprit.
To cut the long story short, after few hours of investigation, I simply changed the storage engine from InnoDB to MyISAM as the last resort and it works like a charm! Complex database query is 4 times quicker and the system now runs significantly faster and my client live happily ever after..
The end
If you like this post, please buy me a coffee.