Jump to content
  • 0

Should I index a Year?


Question

I'm normalising a large Table which can extend to 3-4 million rows.  One of the fields is 'Year'  (eg '2017').   There are up to 80 different years in the database and obviously many are repeated many times,  Is it worth indexing  this field?

I can make a table with a primary key and the related year, such as  y1 = 2000,  y2 = 2001, y3 = 2002 and so on, then relate the primary key to year field in the main Table.    I'm just wondering whether all this fuss for so little is worthwhile.  Is it going to make a performance improvement?  Or should I be doing this a completely different way.

Thanks for any advice

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
On 5/15/2017 at 9:13 AM, Farnsbarnes said:

I'm normalising a large Table which can extend to 3-4 million rows.  One of the fields is 'Year'  (eg '2017').   There are up to 80 different years in the database and obviously many are repeated many times,  Is it worth indexing  this field?

I can make a table with a primary key and the related year, such as  y1 = 2000,  y2 = 2001, y3 = 2002 and so on, then relate the primary key to year field in the main Table.    I'm just wondering whether all this fuss for so little is worthwhile.  Is it going to make a performance improvement?  Or should I be doing this a completely different way.

Thanks for any advice

If you'd like to normalize the database, according to the the 3rd form in database normalization, repeated values should be referenced with a foreign key, therefore if you have time I would recommend doing that. It will increase performance.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...