• dkschill (4/8/2013)


    Here is the build script:

    CREATE TABLE [dbo].[item](

    [item_urn] [int] NOT NULL,

    [cat_urn] [int] NOT NULL,

    [item_mnc] [varchar](10) NOT NULL,

    [item_descr] [varchar](50) NULL,

    [item_active] [char](1) NULL,

    [item_device] [varchar](20) NULL,

    [item_type] [char](1) NULL,

    [dept_urn] [int] NULL,

    [modified_by] [varchar](16) NULL,

    [mod_timestamp] [datetime] NULL,

    [mnc_descr_mod] [char](1) NULL,

    [man_urn] [int] NULL,

    [emp_urn] [int] NULL,

    [link_type] [char](1) NULL,

    [link_urn] [int] NULL,

    [mod_timestamp_server] [datetime] NULL

    ) ON [PRIMARY]

    SET ANSI_PADDING OFF

    ALTER TABLE [dbo].[item] ADD [inspd_loc] [char](1) NULL

    ALTER TABLE [dbo].[item] ADD CONSTRAINT [PK_item] PRIMARY KEY CLUSTERED

    (

    [item_urn] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]

    This is a vendor's table so I don't have control of the definition...

    Here are the results from the DMV:

    index_type_descalloc_unit_type_descindex_depthindex_levelavg_fragmentation_in_percentfragment_countavg_fragment_size_in_pagespage_countavg_page_space_used_in_percentrecord_countghost_record_countversion_ghost_record_countmin_record_size_in_bytesmax_record_size_in_bytesavg_record_size_in_bytesforwarded_record_count

    CLUSTERED INDEXIN_ROW_DATA2016.6666666723679.98312333680090123103.584NULL

    CLUSTERED INDEXIN_ROW_DATA2101110.938967136600111111NULL

    Google Doc with Results

    The leaf-level does not have 368 pages, it only has 6 pages. Unless there is a bug out there I am not seeing then I cannot explain a 10 hour rebuild for this index.

    The only thing that looks odd is that the table was created with ANSI_PADDING ON, and then a new column was added at some point and ANSI_PADDING was OFF. That's usually a deployment mistake and is not intentional but does not typically cause trouble. I have a database (from a third-party vendor coincidentally) that has this all over the place and index rebuilds run fine. It's also 2005 but is on SP4.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato