One table to rule them all?
May 1, 2008 3:12 AM
Subscribe
Can you help structure my oracle database appropriately?
I'm writing an helpdesk application that supports n types of call. A call is logged with the system through an HTML form.
There are certain properties common to each calltype (ID, datelogged, dateclosed, owner, status, for example), but beyond that each calltype has a completely different form. Calltype1 may just have a notes field. Calltype2 may have a notes field plus 10-15 other fields that allows the user to add in more specific information particular to that calltype.
My question is: should I have one table for the common call information and a separate table for each calltype, or one big table that contains all the call information covering the fields of all calltypes? I guess my concern is that I'm adding extra complexity to the database by using many calltype tables to spare what I see as wasted space in the big calltype table.
Is my concern justified?
posted by urbanwhaleshark to computers & internet (10 comments total)
3 users marked this as a favorite
Other Properties are not present for every Call, and are more likely to change as the application evolves ("can you just add some fields here for when the call gets passed to second-line support?"). These are good candidates for being represented, not as hard-coded tables, but as name-value pairs. I'd suggest something along the lines of:
call (callid, etc etc etc)
property (propertyid, callid, name, value)
in other words, treat the Property table as a dictionary array, and leave it to the code to decide what fields are appropriate for a given Call.
(You lose a lot of the benefits of having a database (eg referential integrity) when you go this route, and as you scale it can become horribly inefficient, but I can't imagine that being much of an issue for the volume of data you're likely to be dealing with here).
posted by Leon at 4:12 AM on May 1, 2008