Re: Caching often-used SQL queries

From: Jerry Pisk (jerryiii_at_hotmail.com)
Date: 03/12/04


Date: Thu, 11 Mar 2004 17:14:17 -0800

The problem is that neither one of those are user (session) specific. You
need to enable sessions and store the data in the session context. Or you
can use cookies if there's not too much data.

But I don't think it's worth it, first of all, users do not request the home
page over and over. Second - you'd be caching so much data that it would
take up too much memory and cause a slowdown of everything on the system.
And if you tune your database server you'll spend much more time processing
the data and rendering the page (a step you wouldn't save by caching the
database results) that it's going to be pointless in trying to save a
fraction of your processing time querying the database.

Jerry

"Michael Giagnocavo [MVP]" <mggUNSPAM@Atrevido.net> wrote in message
news:Opd1tk8BEHA.2628@TK2MSFTNGP11.phx.gbl...
> ASP.NET has a cache object built-in. So you could store your dataset in
> there for 5 minutes (or whatever) and save a trip. Even better, if you
can
> move the common parts into a web user control (.ASCX), you can use output
> caching and cache the entire HTML block (so no rendering of controls will
> even occur).
>
> -mike
> MVP
>
> "Shabam" <info@pcconnect.net> wrote in message
> news:FcudnYoJ9_yY2NLd4p2dnA@adelphia.com...
> > Suppose in a .net application a user sees his homepage, which includes
> many
> > elements the requires sql queries. Each user sees a different homepage
> > obviously. Executing these queries every time a user goes to his
homepage
> > is obviously going to drain a lot of systems resources, especially since
> > most of the time it's the same.
> >
> > What are some of the ways to make this efficient? Perhaps some sort of
> > caching mechanism, or even a temporary table that stores just the
elements
> > needed for display in the homepage?
> >
> >
> >
>



Relevant Pages

  • Re: Session or...?
    ... Typically you want to minimize the number of database trips, as well as minimize the amount of information you hold in memory. ... User Credentials, Shopping Cart Contents, Misc Preferences. ... The session would be a good place to store the ID and Qty. ...
    (microsoft.public.dotnet.general)
  • Re: PHP authentication for rookies
    ... >> username and password which you store however you will. ... >> using the php session functions. ... > Are there any advantages to using a database to store user credentials? ... Flat files don't scale or have the ability to do dynamic updates. ...
    (comp.lang.php)
  • Re: PHP MySQL object question
    ... In more complicated applications I layer a business object on top of the database objects. ... For instance, a business object may get information from several different tables, and when you update the data in the business object, it updates the underlying tables. ... Since I am only dealing with one composite record at a time I was planning to store the original field data for before and after comparison to determine when and where updates are needed. ... I could do it as separate session variables, but since each table record will have an associated object, why not just store them that way? ...
    (comp.lang.php)
  • Re: Session sharing between ASP and ASP.NET
    ... In my opinion, and though it may vary depending on the nature of your application, a database to store temporary information based on GUID or some other form of session key generated when the user hits the site and persists during the duration of their visit, would be easier than Yuen's example. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: ASP.Net 1.1 Application Object & ADO.Net DataSet
    ... If the data does not change often, caching the data once for the application ... If the data does change, but not for a session, then caching ... in memory, ... Now what I would like to do is instead of hitting the database every time ...
    (microsoft.public.dotnet.framework.aspnet)

Loading