473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

DB Design / Custom Attributes

I apologize ahead of time for the long post...

Background:
Working on a CRM type custom application. The application is for an
event management company. The company will provide the application for
other organizations to manage their own events. The events include
conferences, corp meetings, sales meetings, etc...
An event planner will define what information is needed for an attendee
to register for an event. We will be providing a standard list of
attributes for the event planner to select from. This list includes
personal information (name, address, phone numbers), air travel
information (preferred carriers, departure airports, etc...), hotel
information, etc...we've included all of the information available to
us from the business's previous experience. As far as the database
goes, all of the standard information given to use will be normalized.

The problem is each event may have unique information that needs to be
collected that is not part of the standard list of attributes. For
example, if McBurgers is planning an event, the event planner may want
to collect an attendee's McBurger employee code.

Depending on the uniqueness of the event, there may be up to 200 unique
attributes defined for it. This number comes from researching events
planned in the last 5 years. The number of attendees for an event range
from 100 to 10,000. The company expects about 3000 events per year.

Database Design
I've done a fair amount of research and found a couple of options to
meet our requirements, more specifically the need for event planners to
define custom attributes for an event.

1-)DynamicColumns:
Add an Event specific custom attributes table. The table would look
something like this:

Event_McBurger05
AttendeeID | McBurgerEmployeeCode | HiredDate | SomeOtherAttribute
-
bz@bz.com | AxEt356 | 01/01/2004 | Other val 2

2-)EAV:
Add an EAV (entity, attribute, value) table. The table would look
something like this:

Event_Attributes
EventCode | AttendeeID | Attribute | Value
-
McBurger05 | ab*@abc.com | McBurgerEmployeeCode | AxEt356
McBurger05 | ab*@abc.com | HiredDate | 01/01/2004
McBurger05 | ab*@abc.com | SomeOtherAttribute | Other val 2

The Value attribute would be a character (probably varchar) datatype.

3-)Stronger Typed EAV
Have an EAV table for each data type. The tables would look something
like this:

Event_CharAttributes
EventCode | AttendeeID | Attribute | CharValue
-
McBurger05 | ab*@abc.com | McBurgerEmployeeCode | AxEt356
McBurger05 | ab*@abc.com | SomeOtherAttribute | Other val 2

Event_DateAttributes
EventCode | AttendeeID | Attribute | CharValue
-
McBurger05 | ab*@abc.com | HiredDate | 01/01/2004

There would be one Event_[DataType]Attribute table for each of the
datatypes allowed.

Pros/Cons

1-)DynamicColumns

Pros:
-Data integrity can be enforced
-Simpler queries for reporting
-Clearer data model for understanding data stored

Cons:
-Row size limitation of 8k must be managed (probably need to add
another table if run out of room.
-Stored procedures for CRUD operations would need to dynamically
created OR
Need to use dynamic SQL on the database or application.
-Adding/Removing columns on the fly can be very error prone

2-)EAV
Pros
-Static CRUD stored procs
Cons
-No data integrity
-Complex queries for reporting
-Worse performance than option 1.
-Table can get BIG...fast.

3-)Stronger Typed EAV
Pros
-Static CRUD stored procs
-Better data type integrity than EAV
Cons
-Complex queries for reporting
-Worse performance than option 1
-Table can get BIG...fast.
If you are still reading this...thank you!

The Questions:

-Are there other options other than the 3 described above? Or are these
pretty much it with slight variants.

-Does anyone see any missing Pros/Cons for any of the options that
should be considered?

-Is there a "preferred" method for what I am trying to do?

I suspect this will come down to the lesser of three devils. Just
trying to figure out which of the three it is.

We have prototyped the three options and are leaning towards option 1
and 3.

Any comments/suggestions are appreciated.

Thx

Aug 24 '05 #1
3 2865
Hi

What I have seen done in similar IT/CRM apps is the use of placeholder
columns.

i.e. in what you call the event table there would be on top of the
mandatory and key attributes, also ,say, 50 columns ,
custom1,custom2,custom3 .... custom50
they are all int type, and have a foreign key to another table:
table custom1values(id int, value varchar)

you have another table, called column_usage indicating which of the
columns are being used and what are their logical names.

the only problem with this attitude is that the report query to fetch
the data cannot efficiently be a join, but rather is a query first to
see what columns are in use, and then a join query using only the
necessary tables.

By the way, I am not sure if this is in your requirement, but this
allows the users of the system to add/alter custom properties as the
system runs. you give them a ui that defines column names and update
the column_usage table.

hope this helps
Tzvika

Aug 24 '05 #2
Good alternative.

This falls somewhere in between options 1 and 3. I like the idea of not
having to create columns dynamically. It still suffers some of the same
issues as EAV though:

Pros:
-Static CRUD stored procs
-Better data type integrity than EAV
-Easier reporting than EAV (will have to get user defined attribute
name from a MetaData table however).

Cons:
-Column sizes are static (same with EAV)
-Can't enforce column constraints for an event (same with EAV)
-Can run out of custom attributes (which may be something we can live
with as long as we allocate enough "place holders"...but at up to 200
custom attributes, that may be quite a few place holders).

Thanks for the input...really apreciate it.
Thx Tzvika.

Aug 25 '05 #3
I am "moving" this thread to the microsoft .public .sqlserver newsgroup
in hopes to get more replies...

Thx.

Aug 29 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit...
5
by: Doug Holland | last post by:
Often you see code where an empty interface is used to indicate something about the class that realizes it. In the .NET world this can be done with custom attributes too, so which is better: ...
1
by: Eric | last post by:
I have what should be a fairly simple design question. I usage of mySQL will revolve around a common group + user system. There can be multiple groups and each group will contain some subset of...
8
by: John Lee | last post by:
Hi, If I want to check permission on each public method of a web service, (assume the checking routine is ready to use and called AccessCheck) , one way of doing it is to call this AccessCheck...
3
by: Edward Diener | last post by:
I understand the syntax of custom attributes, but I have no idea what they are supposed to do. Anyone care to give me a clue as to their functionality ?
0
by: scpedicini | last post by:
Okay, I've been having a problem with custom design-time properties that has been driving me nuts for about a week. The control that I'm working on extends System.Windows.Forms.AxHost, but I'm...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
4
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying...
2
by: Tem | last post by:
I have 2 projects a classlibrary project and a windows forms project. the winform app calls the library to perform certain functions and returns the results. however i run into a problem where...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.