| PAGES: 1 2 3 next» |
|
| ||
Artificer
|
Building a Database | |
|
What really goes into making a database? Should you design it in a certain way? Are there rules of what you should or should not do? ------------------- | ||
quote quick quote edit quick edit del report
| ||
| Members, log in or register to remove these ads. | ||
lord monkeyRock Me Sexy Jesus
s-e-e-k-e-r wiki staff dynastywarriors ![]() ![]() ![]() ![]() ![]() total posts: 1741 GameGrep pts: 394 since: Jun 2003 |
re: Building a Database | |
|
I think this is great. We don't really have any database specific threads around here like this. ------------------- | ||
quote quick quote edit quick edit del report
| ||
Vermillionmoderator
Action [DS] Animal Crossing: Wild World [DS] Gangs Wi-Fi Discussion wiki staff tales zelda ![]() ![]() ![]() ![]() ![]() since: Jan 2006 |
re: Building a Database | |
|
Yeah, an introduction to the different Databases like MySQL, MySQL Lite, Oracle, and so on, sounds good. ------------------- | ||
quote quick quote edit quick edit del report
| ||
Artificer
|
re: Building a Database | |
|
What about before all of the stuff you (lord monkey and Vermillion) have mentioned? I know that the issues you've brought up are important, but... ------------------- | ||
quote quick quote edit quick edit del report
| ||
Vermillionmoderator
Action [DS] Animal Crossing: Wild World [DS] Gangs Wi-Fi Discussion wiki staff tales zelda ![]() ![]() ![]() ![]() ![]() since: Jan 2006 |
re: Building a Database | |
|
You mean like how to organize my tables on a database for my forum? Or like "What Data do I need to create a moderator"? ------------------- | ||
quote quick quote edit quick edit del report
| ||
Artificer
|
re: Building a Database | |
|
If by "organize my tables" you mean deciding on which columns go where, then it's a bit of both. On the one hand, you have to know what you want. (In some cases, you're not the person who decides what is wanted, so this is really important.) Once you know what you want, you have to figure out how to structure it into a database (if you even decide to use a database). ------------------- | ||
quote quick quote edit quick edit del report
| ||
Artificer
|
re: Building a Database | |
|
So let's say before we think about MySQL, before we even think about databases or tables, our first step is to gather the data we want to store. In this case we are the ones who define what we need, so it makes this step a little easier. ------------------- | ||
quote quick quote edit quick edit del report
| ||
lord monkeyRock Me Sexy Jesus
s-e-e-k-e-r wiki staff dynastywarriors ![]() ![]() ![]() ![]() ![]() total posts: 1741 GameGrep pts: 394 since: Jun 2003 |
re: Building a Database | |
|
So for bare minimum for a forum, you would need a unique id for each one, a title, maybe a description, and permissions, but thats going over board. ------------------- | ||
quote quick quote edit quick edit del report
| ||
Artificer
|
re: Building a Database | |
|
Let's say that we don't care about description, permissions, locking threads, stickying threads, or IP address of the poster for this example. Those are good ideas though, so keep them in mind for later. ------------------- | ||
quote quick quote edit quick edit del report
| ||
tekmosis
|
re: Building a Database | |
|
btw, if any of you are going to a post secondary institute where you'll be going over DB design, they'll highly favor normalization. My classes all loved going to 3rd normal at most. Normalization == crap in a lot of real world practices.
Take note of the fields I've stared. In school they'll teach you that you need another table(s) for those bits of information. However, that just means more table joins and results in a higher overhead. This is why I say that normalization in a lot of real world scenarios just doesn't cut it. Also take note that I've stuck to a consistent pattern with my fields, all id fields are separated as such <descriptor>_id. I don't mix it up like forumid, member_id. I also opted not to stick with the same field names in the threads table for the user_id. Rather than being ambiguous just by looking at the table you know that created_by is the memberid belonging to the person who created the thread. For organization you can also do database schema's which map out table relations. Ex: http://upload.wikimedia.org/wikipedia/commons/4/41/Mediawiki-database-schema.png I just recommend glancing at it and not to read into it too much. It's not the easiest thing to grasp and may just end up frustrating you and make you think that db design is for the extremely crazy. I do schemas a lot at work but nothing fancy like that, I just use a pen and paper. I actually had a situation last week where I needed to do a small schema of MediaWiki so I could figure out their insane structure for this neoseeker feature otherwise you just get confused with data relations too easily and end up wasting time while getting frustrated. Wow, this is getting a bit long. Can you tell I like db design? ;P It was always one of my favorite topics in school. Although, from working at Neo and with Red I've learnt far more than I ever did in school. This message was edited by tekmosis on Aug 25 2008. ------------------- Do you <3 Faith? Win a copy of Mirrors Edge!
| ||
quote quick quote edit quick edit del report
| ||
Liam
|
re: Building a Database | |
|
Tekmosis, how comes you choose to include the stared fields at all? Obviously all of which can be generated by SQL statements anyway (count, most recent date etc.), do you find it is more server friendly? I guess it does make queries more simple yet also means more queries when adding/removing threads. | ||
quote quick quote edit quick edit del report
| ||
Artificer
|
re: Building a Database | |
quote tekmosisTotally disagree. I understand that denormalization is favored when you have performance problems in your database, but doesn't Neoseeker have a few problems with denormalization? I've noticed situations where data updates in one location, but it doesn't seem the update is made in all the places it should be. IM me for an example—it's in the mod forum. Also the starred fields you have laid out do not demonstrate denormalization; they are simply derived columns. As Liam said, better SELECT performance, but poorer INSERT/UPDATE/DELETE performance. I agree that is probably appropriate in Neoseeker's case since the most common use case would be browsing forums, etc. As long as you can keep those derived values updated, then sure, it's a good idea. Bare with me, tek. I prefer not designing DBs at the physical table structure level but with another technique that doesn't even involve normalization theory. At the worst, you'll think I'm totally wrong, but hey, that's a risk I'm willing to take. [size=1][color=#666666]This message was edited by Artificer on Aug 26 2008. ------------------- | ||
quote quick quote edit quick edit del report
| ||
tekmosis
|
re: Building a Database | |
|
The forums were coded back in 1990-esq(?) so using the forums as an example doesn't really hold water to the topic. ------------------- Do you <3 Faith? Win a copy of Mirrors Edge!
| ||
quote quick quote edit quick edit del report
| ||
Artificer
|
re: Building a Database | |
quote tekmosisWell, that's surprising to hear. We can discuss other things then. quote tekmosisJust because you have a fewer number of queries doesn't mean you are denormalizing. The tables you showed are still in at least 3rd normal form. quote tekmosisYou would actually do the same number of queries by doing what Liam suggested; you would just have an extra join. You do have more queries to run using your method when inserting/updating/deleting since you have to update the derived value (e.g. total_threads) as well. [size=1][color=#666666]This message was edited by Artificer on Aug 26 2008. ------------------- | ||
quote quick quote edit quick edit del report
| ||
tekmosis
|
re: Building a Database | |
|
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html#06 quoteWhat I'm doing is just that, I'm taking scalability into account and denormalizing the structure to accommodate better performance by requiring less quries/joins. The fact that I don't have tables: total_threads_by_forum, thread_statistical_information should be proof enough that I'm denormalizing ------------------- Do you <3 Faith? Win a copy of Mirrors Edge!
| ||
quote quick quote edit quick edit del report
| ||
| [All dates in (PT) time] | Threads List « Next Newest Next Oldest » | |
| PAGES: 1 2 3 next» |
Powered by neoforums v0.9.4 (equilibrium)
Copyright Neo Era Media, Inc. 1999-2008