• 0
Farnsbarnes

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

Share this post


Link to post
Share on other sites

2 answers to this question

  • 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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now