Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 558981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:11:20+00:00 2026-05-13T12:11:20+00:00

I have a large DataTable cached in my web app that is the result

  • 0

I have a large DataTable cached in my web app that is the result of a complex query that returns a large data set. Whilst this data table is cached the query that runs to “refresh” this cache still takes a long time, largely due to the sheer amount of data being returned.

In order to speed this up I am considering implementing a timestamp type approach to my tables in order to limit my query to only return rows which have changed.

I then intend to merge this smaller dataset with my cached datatable.

Has anyone done anything similar to this, or is there anything out there that handles this already?

I feel this could be a re-inventing the wheel situation if I dive straight in.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:11:21+00:00Added an answer on May 13, 2026 at 12:11 pm

    Personally, I’ve used the timestamp approach before and that does work well – it does make the caching more efficient by only retrieving the data that has changed since the last read.

    Alternatively, I’d suggest the SqlCacheDependency class which takes care of keeping the cache up to date for you. I can’t comment on any real-world pros + cons of this, or of performance comparison vs. timestamp approach as I haven’t used it myself.

    There’s another useful article on SqlCacheDependency here

    Update:
    Yes, I don’t think it will actually refresh the data. It sounds like you’d have to do that yourself.
    From the 2nd link:

    When the data changes—and only
    then—the cache items based on that
    data are invalidated and removed from
    the cache. The next time you request
    that item from the cache, if it is not
    in the cache, you can re-add the
    updated version to the cache and be
    assured that you have the latest data

    There’s also SQL 2005 specific implementation notes in the 2nd link:

    SQL Server 2005 monitors changes to
    the result set of a particular SQL
    command. If a change occurs in the
    database that would modify the results
    set of that command, the dependency
    causes the cached item to be
    invalidated. This allows SQL Server
    2005 to provide row-level
    notification.

    I personally think I’d go for the timestamp approach (that’s what I’ve done before) as I can’t see on the face of it that SqlCacheDependency would give any performance benefits – I think it would be less performant (just easier to implement). One day, I’ll get round to actually trying out SqlCacheDependency to do a proper performance analysis 🙂

    Update 2:
    Regarding the merging of new data into the existing datatable, I think the Merge method of the datatable is what you want.

    The Merge method is used to merge two DataTable objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing DataTable.
    …
    …
    When merging a new source DataTable into the target, any source rows with a DataRowState value of Unchanged, Modified, or Deleted, is matched to target rows with the same primary key values. Source rows with a DataRowState value of Added are matched to new target rows with the same primary key values as the new source rows.

    You just need to ensure you define the column(s) on the datatable that are the primary key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large data.DataTable and some formatting rules to apply. I'm sure this
I have a large result set assembled in a parent/child relationship. I need to
I have a web app, that consumes a web service. The main page runs
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I
I have a large codebase that targetted Flash 7, with a lot of AS2
I have a large database and would like to select table names that have
I have a large amount of data stored in an XML file, 173 MB
I have a very strange situation. I have a large set of records to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.