To Use or Not to Use Databases
Databases have become very popular over the last two years on the web, especially with the gaining popularity of languages like PHP, which enable easier connection with databases. I thought it would be useful to talk about when it made the most sense to institute a database into a particular application.Databases have become very popular over the last two years on the web, especially with the gaining popularity of languages like PHP, which enable easier connection with databases. I thought it would be useful to talk about when it made the most sense to institute a database into a particular application.
An increasing number of site operators are starting to rely more on databases in situations where their use is simply not advantageous. I saw a couple programs yesterday toting how because they used mySQL, they were superior to those that didn’t use mySQL. I couldn’t disagree more with such a general statement like that. Sure, in some applications using a relational database such as Oracle, PostgreSQL, mySQL, etc., CAN be superior, but you have to remember these databases bring overhead. And with overhead eventually comes issues like load balancing so that access to all that precious data doesn’t end up in a bottleneck.
A site that relies on intensive searching like say mlb.com has to use a sophisticated relational database or searches would take eons, not to mention raise the possibility of corruption of traditional flat file data. If one is going to be doing any kind of medium/advanced types and/or habitual searching over a medium to large amount of information, a database is far superior than any flat file storage scheme.
Now let’s look at the average adult “free” website. How often do you need advanced relational searching across the data to look through a few pictures in a gallery before going off to a sponsor for more?
A TGP, top list, picpost or links site might be a situation where using a database would be advantageous. But it depends, again, on how often you need to search through the information, how much information you are searching through, and how many people will be searching for this information over a short period of time (peak traffic). I use the term “search” very loosely here; I really mean “access to the data” in more a general sense. The point is a line exists there that when crossed the benefit of using a database outweighs the downside of the increased overhead.
A paysite would definitely benefit from generating their content through a relational database model. At least it would inside the members area where it is perhaps not as critical to gain search engine attention.
Just think what they could do: They could track the pictures/videos/galleries being accessed and know on a per-surfer basis what their surfing habits were and customize the content per member. They could even devise ways to reward members (financially?) based on their usage. The guy who whacks it once a week should get a discount or perk over the guy who is in there 4 times a day, IMHO. This would be a creative approach to bringing the profit margins back in line and might help with retention as well.
I believe the future of paysites will turn to more of a controlled usage environment instead of the dominant “all you can eat” model that exists today, especially as bandwidth becomes more commonplace and plentiful on the client side (DSL/cable).
The alternative is lowering payouts to affiliates, cutting the amount and quality of content, or (sigh) raising prices further to members. I also don’t think the majority of adult surfers are willing to pay $50+ /month for porn memberships at this time. At minimum wage, that’s a full day’s wages. Naturally one could argue that the average adult surfer makes more than minimum wage, but I think my point is clear.
In summary, try to step back from your projects and ask some of the questions I’ve raised, before thinking that turning to a database is a catch all solution or that by not using a database you are “missing out” on improving the application.
TDavid is co-owner, programmer and webmaster for several sites devoted to programming including tdscripts.com. You can ask him technical questions LIVE on the radio every Friday at 2pm PST/5pm EST at scriptschool.com/radio.