Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 DateTime for LastModified Column

Author  Topic 

sogsolutions
Starting Member

2 Posts

Posted - 2011-04-04 : 13:34:37
We have a client-side application that contains data grids that display the client's data. In order to mitigate refresh times, we want to implement a short-term and possibly a long-term solution. The long-term solutions would be a paging system, where users can page through sets of data.

The short-term solution is to implement a LastModified (datetime type) column, and update that manually, as there's only a handful of locations where the data rows are actually updated. The functions that read the data can then do a 'SELECT ... WHERE LastModified > LastRefreshTime', thereby only SELECTing the data that's changed since the last refresh time.

Most of the existing row data won't change often, so most of the Refreshes will only include new data, that was added since the last Refresh.

Is this an appropriate solution to our problem, and is it safe to use the LastModified datetime column as an index?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-04 : 13:37:46
Yes it is safe to be index that column, it would in fact be highly recommended. You may want to make it a covering index if that query will run frequently, which it sounds like it will.

The solution seems fine.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sogsolutions
Starting Member

2 Posts

Posted - 2011-04-04 : 16:51:33
Thanks, tkizer.

Can you please explain what a "covering index" is, and how we can implement that?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-04 : 16:56:22
It means it covers your query. For instance, take this as an example:

SELECT Column1, Column2, Column3 FROM YourTable WHERE LastModified > LastRefreshTime

You could index that query like this: LastModified INCLUDE Column1, Column2, Column3

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -