Calculating monthly reports or statistics – MVC Entity Framework LinQ

I am using MVC (C#) and the Entity Framework. I have a sql server database with tables called Profile, Gallery, ArtWork :

PROFILE:
UserName,
FirstName,
etc…

  • Text XML to Sql Table… there and back again
  • FullCalendar, how do I allow users to edit/delete events and remove them from the database?
  • SQL Server, can't insert null into primary key field?
  • Why does TSQL on Sql Server 2000 round decimals inconsistently?
  • SQL Server tells me database is in use but it isn't
  • Set date field to null
  • GALLERY:
    GalleryID,
    UserName,
    GalleryName,

    ARTWORK:
    ImageGuid,
    GalleryID,
    Description,
    PublishDate,
    Views,
    Downloads,

    I have the following relationship between the tables:

    Profile->Gallery->ArtWork (Foreign keys in bold above)

    What I would like to know is the most efficient way to aquire the following for the stats page:

    1. The Top 10 Downloaded bits of art work of the month

    2. The most Downloaded designer of the month.

    Its easy enough to construct the LinQ for the above but I don’t want to be hitting the database everytime a user views the stats page. There could be 30,000+ designers having 5000+ bits of artwork each, and i dont want these results being calculated everytime someone hits the stats page. I only want to hit the database daily for stat 1, and monthly for stat 2.

    Am I best using a view for each stat in the database and hitting that all the time, or would it be best setting a timer to hit the database daily and monthly (if so how please?), or is there a better way.

    Thanks In Advance

  • Sending data from excel to Server using HTTP Post
  • SQL Server Recognise SP_EXECUTESQL as object rather than Procedure Name
  • SQL Server what to use for folio column (used to have Identity column)
  • Trouble with jQuery MaskMoney plugin and Field type Decimal (SQL SERVER table)
  • MVC4: UserIsInRole - Unable to connect to SQL Server database
  • Logic behind data source=(local) in connection string
  • One Solution collect form web for “Calculating monthly reports or statistics – MVC Entity Framework LinQ”

    I would store the query result in the application Cache. If you do this it doesn’t matter so much how you construct the query, since it will only be run once until the cached item expires.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.