2

I have the following table

Events:

EVENT_ID EVENT_OWNER_ID EVENT_NAME EVENT_DATE EVENT_PRIVATE EVENT_ACTIVE

All fields except EVENT_NAME are either date, int or bit.

Is it more efficient to have another table to match between the EVENT_ID and the EVENT_NAME and when I need I will just use JOIN to see the event name? or is the JOIN less efficient than just having one table with the EVENT_NAME as I currently have?

2
  • 2
    What is your criteria for efficiency? Commented Nov 1, 2010 at 8:53
  • When I say efficiency, I am basically asking to compare the speed between the 2 options when I have millions of rows in this table. Commented Nov 1, 2010 at 8:56

4 Answers 4

1

Two tables is less efficient in all respects unless you are keeping track of recurring events that use the same name (Example of Normalization). The only resources that that technique would save is a very small amount of disk space. As far as efficiency for queries go, one table will always be more efficient.

Basically if there is a one to one relationship between two pieces of data(in this example it would be the Event_Name and the rest of the event data) you will want that data in the same table.

If you want to know more about it, Google Normalization vs. Denormalization.

Sign up to request clarification or add additional context in comments.

1 Comment

@JN - 1up for pure simplicity in your answer.
0

It is not correct to store event fixed information in the event's list. if you decide to change the event name - you will have to change a lot of rows, rather than 1 row.

your db should be normalized. in the events list - only ides, and event specific data (date, time, generator) in the event_id list - the fixed data on the event (name, severity, like to documentation ect...)

Comments

0

If an event can only ever have one owner, one name, and one date... then you're fine keeping it in one table.

Comments

0

I think two tables is probably less efficient, but the answer may depend on the hardware you are running on and the total size of the table. If the total size of the table is 100Mb then you can probably get the whole thing in memory.

More important for efficiency is the indexing and othe rquery optimisation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.