SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to check when was the last Time re-indexing was performed on a DB


How to check when was the last Time re-indexing was performed on a DB

Author
Message
sqlpanther
sqlpanther
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 198
hello All,
Can someone suggest me a scrpit or a command that can provide me information about last time re-indexing performed on the DB, I know I can run DBCC CheckDB but its taking a lot of time, is there any other way?
GilaMonster
GilaMonster
SSC Guru
SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)

Group: General Forum Members
Points: 234544 Visits: 46373
CheckDB won't tell you the last time an index was rebuilt (however you need to run it regularly).

That information isn't stored by default. If you're running a reindexing job, you can look at the job history and see when it last ran. Many custom index rebuild scripts have their own logging table.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Ramkumar (LivingForSQLServer)
Ramkumar (LivingForSQLServer)
Mr or Mrs. 500
Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)Mr or Mrs. 500 (537 reputation)

Group: General Forum Members
Points: 537 Visits: 620
looks like modify_date in sys.objects updates rebuild date&time. but no further details available in system view on what caused that modifiation.
In short: answer to your question is no.


create database test_reindex
go
use test_reindex
go
create table reindex_test(col1 int primary key, col2 int)
go
create index nci_col2 on reindex_test(col2)
go

select * from sys.indexes where OBJECT_NAME(object_id) = 'reindex_test'
select create_date, modify_date from sys.objects where name = 'reindex_test'

alter index PK__reindex___357D0D3E7F60ED59 on reindex_test rebuild

select create_date, modify_date from sys.objects where name = 'reindex_test'

alter index nci_col2 on reindex_test rebuild

select create_date, modify_date from sys.objects where name = 'reindex_test'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search