Is there any meaning that creating a cluster index on a datetime column?

Last post 07-27-2008 10:03 AM by zhenyuanDeng. 9 replies.
Page 1 of 1 (10 items)
Active Topics My Discussions Unanswered Sort Posts: Previous Next
  • 07-04-2008 8:56 AM

    Is there any meaning that creating a cluster index on a datetime column?

    logic sequence :

    row1:2008-01-01 12:03:24

    row2:2008-01-02 12:03:24

    row3:2008-01-01 12:03:24

    Will SQL SERVER save the data like that(physical):

    row1:2008-01-01 12:03:24

    row3:2008-01-01 12:03:24

    row2:2008-01-02 12:03:24

     

  • 07-04-2008 10:55 AM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

    when you create clustered  on a column which has duplicate rows SQL Server has to "uniquify" the rows but it will take addional space and time...

    Check the following...

    http://www.sqlskills.com/blogs/kimberly/2007/02/02/TheClusteredIndexDebateContinues.aspx

     

    MohammedU.
    Microsoft SQL Server MVP
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  • 07-07-2008 2:11 AM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

    How SQL Server stores the data physically is meaningless.  It might be contigous or not. However in any case the page chain will be maintained and the page chain will look like your example. A smalldatetime attribute alone probably makes up only for a poor clustered index, imho

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Contributing Editor, Writer & Forum Moderator http://www.sql-server-performance.com
    Webmaster: http://www.insidesql.org
    View Frank Kalis's profile on LinkedIn

    XING
  • 07-08-2008 5:56 AM In reply to

    • satya
    • Top 10 Contributor
    • Joined on 11-05-2002
    • United Kingdom
    • Posts 22,515
    • Microsoft MVP
      Moderator

    Re: Is there any meaning that creating a cluster index on a datetime column?

    SQL Server can use index on DateTimeField or on any other filed based on UniqueNumberWithIndex. If any of those is determined (based on the values and the statistics) very selective, then that will be used. If both are less selective, then SQL Server can join the indexesin run-time and used the combination of those two indexes (this is called index intersection).Checking the query plan will tell you which is always a best one to check, and also depending on the query you have to provide index hint . If you are adding a column to your select , may be better to add that column as second column in your datetimeindex

    -Satya S K J

    SQL Server MVP



    Knowledge is Power, you will gain by sharing it. SSQA.net - Invisible contributions to the users & visible success in SQL Community.
  • 07-09-2008 6:52 AM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

    My meaning is that: a table has many fields including one calling d_date (datetime) , and i want to select d_date for clusted index.

    Is that right? why?

    Thank

  • 07-09-2008 6:52 AM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

    My meaning is that: a table has many fields including one calling d_date (datetime) , and i want to select d_date for clusted index.

    Is that right? why?

    Thanks everybody!

  • 07-09-2008 8:15 AM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

    Sorry, but without indepth knowledge of your system, tables, queries, etc... it is impossible to judge to the clustered index. My guess would be that there are better candidates for it, but this is just my guts.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Contributing Editor, Writer & Forum Moderator http://www.sql-server-performance.com
    Webmaster: http://www.insidesql.org
    View Frank Kalis's profile on LinkedIn

    XING
  • 07-09-2008 4:04 PM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

     you can , but why not to be non clustered index.

    you have only one cluster index for the table, and it is best to be used for PK


    View Mahmoud Hassan's profile on LinkedIn
  • 07-10-2008 5:25 AM In reply to

    • satya
    • Top 10 Contributor
    • Joined on 11-05-2002
    • United Kingdom
    • Posts 22,515
    • Microsoft MVP
      Moderator

    Re: Is there any meaning that creating a cluster index on a datetime column?

    -Satya S K J

    SQL Server MVP



    Knowledge is Power, you will gain by sharing it. SSQA.net - Invisible contributions to the users & visible success in SQL Community.
  • 07-27-2008 10:03 AM In reply to

    Re: Is there any meaning that creating a cluster index on a datetime column?

    Thanks satya again. I think i understand what is a "datetime column" cluster index now.Big Smile

Page 1 of 1 (10 items)
Active Topics   My Discussions    Unanswered Posts


© 2000 - 2007 vDerivatives Limited All Rights Reserved.