SQL Server Performance

Index on column DATETIME.

Discussion in 'SQL Server 2005 Performance Tuning for DBAs' started by LucasDa, Jun 9, 2009.

  1. LucasDa New Member

    Hi.
    I have two question about the Index in SQL 2005.
    First Question.
    At some point I hear that not it's good have or Create an Index on a column the type DATETIME. For example If I have a table with the columns First_Name, Last_Name and Date_of_Birth not it's recommended Create an Index on the column Date_of_Birth.
    Second Question.
    My second question it's about order of the columns within the Index. For example Whenever I create an Index, I put in first place the column of type NUMERIC (int, tinyint, bigin, etc), secondly the column of type CHAR (varchar, nvarchar, char, nchar, etc), thirdly the column that have a lot of NULL values. Is this good or is there another way to analyze the order of the columns for an index?
    Thank.
  2. FrankKalis Moderator

    [quote user="LucasDa"]
    I have two question about the Index in SQL 2005.
    First Question.
    At some point I hear that not it's good have or Create an Index on a column the type DATETIME. For example If I have a table with the columns First_Name, Last_Name and Date_of_Birth not it's recommended Create an Index on the column Date_of_Birth.
    [/quote]
    If it is beneficial to your queries, I see no reason not to index a datetime column.
    There are no hardcoded rules about the order of data types in an index. It's more about the selectivity. The usual recommendation is to put the most selective column first in the index.
  3. Sandy New Member

    Hi Lucas,
    I agree with Frank. It depends.
    Thanks,
    Sandy.
  4. satya Moderator

    As Frank covered the most of it, I would like to ask whether you have already implemented these and having problems or something you wanted to go by best practices?

Share This Page