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

  • SEARCH
  • Home
  • 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 7594645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:28:19+00:00 2026-05-30T21:28:19+00:00

I have a SQL2008 table of automotive makes, models, and year. To display a

  • 0

I have a SQL2008 table of automotive makes, models, and year. To display a list of years to the user I need to know the lowest and the highest years in the table, like 1919 – 2012.

I use a LINQ query as follows:

return (from car in context.Cars select car.Year).Min();

…which turns into this SQL query:

SELECT MIN([t0].[Year]) AS [value] FROM [dbo].[Cars] AS [t0]

I know (and you know) that the min will rarely if ever change and the max will change, at most, once per year. But since they are indeed data-dependant, they’re not suitable as constants. Since they -could- change during runtime, I don’t want to make them static.

I’m assuming that SQL will cache that min and max, and as long as the underlying tables are not modified, it’s smart enough to return me cached information. Until and unless it ever became a performance bottleneck, it’s more of a curiosity, but to what extent can I rely on SQL (in this case, SQL2008 R2) caching query results as long as the tables do not change?

  • 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-30T21:28:20+00:00Added an answer on May 30, 2026 at 9:28 pm

    Well instead of even hitting the database why not cache it on the application level? You can use SqlCacheDependency SQL Cache Dependency
    Invalidate the cache if the table changes otherwise don’t even hit it.

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

Sidebar

Related Questions

SQL2008. I have float values in a table which need to be overriden folowing
in my SQL2008 I have a user which is in the db_datareader, db_datawriter and
I have SQL2008 installed on my local machine and need to view/alter/select rows and
I have a table in my SQL2008 DB for Users and one for Roles
Within my database (SQL2008), I have a customer table and a country table (among
I have created a table that has a strongly type XML column in SQL2008
I have a table on SQL2000 with a numeric column and I need the
I have a table in sql 2008 named tblEmployeeAttendance like Here is some dummy
I have the SQL2008 version of SMO and although it uses this class internally
I have created login account on my localhost\sql2008 Server (Eg. User123) Mapped to Database

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.