Sadly, I’m catching a cold. I seriously hate being sick, all my motivation goes to nada. Yet I wanted to post on this subject, while I’m not going to get all specific and detailed about it. I will mention basic factors of designing your database. I have this book I bought on the many programming books I have, it was requested by my professor to use it in our database design class but we actually never got to use it.
Now it bothered me, I don’t like buying things without a purpose so I opened it to apply things I learnt in my project. I did learn a few things about database designers, they are divided in two tasks, one is to design the database and the other is to check engines and worry about all physical files and how they are going to be managed. And so on, since it had this overwhelming history of flat files. And it got me to thinking of PHP and some developers.
While I love so much PHP, it’s disheartening to see many people just to rush over the project start assigning all kind of unneeded data types. Let’s be realistic, many people use Int over Medium Int because they “foresee their application passing over a range of 9 millions”, to actually reach that amount it will take years unless you spend an insane amount of money in promotions to get all kind of traffic. You can’t be a microsoft or a google in a year.
It also makes me glad in a way, this mistakes generate jobs, didn’t you know? Because the buyers who hired those kind of people and made the database design shaky, don’t know why their page is slow or why their query is so slow. By putting a higher range, it means more work for the database engine.
Don’t go adding all type of indexes, just the ones your APPLICATION use most of the type. Like for example we got our auto-incrementer primary key (id), it is UNIQUE so MySQL will check UNIQUE ones first than non-unique ones. Or if we got lets say (categoryID, attachmentID) we got non-unique IDs, but they are mostly searched in a query statement.
Secondly, while I won’t probably real-world examples. A bad design can lead the web application to become a nightmare to maintain or add new features because you will end up refactoring or worst, re-designing your database.
Read this page, it’s from MySQL‘s documentation. It’ll be a guide to you if you are designing the database using that database system.
I was thinking, after I release OpenType Threads, oh boy I should be prepared to receive a rain of complains. And shield myself from patterns fanboys. Oh, and I started to like Ruby and Javascript syntax, it’s quite… fun. And now, making extra code to support other browsers is NOT fun.
