C# - SQL Server To Cache A Certain Result Set?

Nov 4, 2010

There is a certain query that is being called from an ASP .NET page. I studied the execution plan of that query in Management Studio and 87% is for a sort. I badly need the sorting or else the data displayed would be meaningless.

Is there anyway that I can request SQL Server to cache a sorted results set so it will return the data faster in consequent runs?

Or is SQL Server smart enough to do the cache handling and am I doing mistake by trying to force it to cache results, if that is possible?

UPDATE:

I just read in an article that creating a View with a clustered index will increase performance because the index will persist the data in a view to disk. Is this true? How do i get about doing this?

View 5 Replies


Similar Messages:

C# - Cache Whole Result Set Or Based On User?

May 17, 2010

In my web application i have statistics which shown for each user separately ie. posts made , posts made today , articles started by and so on...

Each user has his own special statistics.

What is more flexible and "right" to work with one huge DataTable in Cache with whole data from all users and then loop thought DataTable to find certain user data or to cache each user ie. cacheObj + userID...

View 1 Replies

Custom Server Controls :: How To Programmatically Cache A Server Control And Add A Cache Dependency?

Feb 11, 2011

I have a server control that I developed which generates navigation based on a third party CMS API. Currently I am caching this control using the PartialCaching attribute. The CMS uses cache key dependencies to invalidate the cache when a user makes an edit, however in the case of my server control it does not get invalidated and the updated navigation will not show up until the cache expiration set by the PartialCaching attribute.Here is my two part question:

What is the proper way to programmatically cache a server control, without using the PartialCaching attribute, and adding a cache key dependency?

Is it possible to continue to use the PartialCaching attribute and add a cache key dependency?

View 2 Replies

Better Performance To Query The DB Or Cache Small Result Sets?

Mar 14, 2011

Say I need to populate 4 or 5 dropdowns w/ items from a database. Each drop down will have < 15 items in it. These items almost never change.

Now I could query the DB each time the page is accessed or I could grab the values from a custom class that would check to see if they already exist in ASP.Net's cache and only if they don't query the DB to update the cache.

It's trivial for me to write but I'm unsure if the performace would be better or not. I think it would be (although not likely anything huge).

View 4 Replies

Architecture :: Distributed Caching / Keeping Cache In Sync Between Multiple Webservers Or Even Better Farm Cache Management To Another Server?

Feb 26, 2010

I've got a web application that runs of a state server. It looks like soon it may need to distributed and there will be two web servers behind a load balancer.

This works great for session state but my next challenge is Cache

My application leverages heavily of cache. I understand ASP.Net 4.0 will be offering more here but nothing much has been said about the how too.

There are two challenges that I face

1). Each webserver will have its own copy of cache whereas it would be more efficient to put this to a third server the same as session state is put to state server.

2). The real challenge is keeping cache in sync if a simple dataset derived from the database is changed my code dumps that cache item and reloads the cache. That's all well on one webserver but webserver number two wont know to drop that particular cache item and reload it. This could cause some unexpected problems in the application.

For scenario number 2 I could attempt to do some smart coding so server number two knows to dump the cache and reload it.

My guess is someone else has already been here before and there's probably a better implementation approach rather than writing extra code.

Does anyone know how I could achieve the goal of keeping Cache in sync between multiple webservers or even better farm Cache management to another server?

View 2 Replies

Multiple Single-result Sql Server Stored Procedures Or Single Multple-result Stored Procedure?

Aug 9, 2010

Background: I use stored procedures exclusively for an ASP.NET application. I am using a DataReader to load a dataset object.

View 4 Replies

SQL Server :: Server Cache Dependency Enable Tables?

Aug 25, 2010

Using the [Code].... for server cache Dependency, to get a list of the tables that are enabled, We use the line below:

[Code]....

View 2 Replies

Forms Data Controls :: Displaying Correct Result Inside DropDownList From LINQ Query Result

Jul 1, 2010

I have this ListView that has a Drop Down List.Everything works fine (I think/hope) except that the drop down list are not showing its result correctly.This is the code.

Front-End
[Code]....

The code behind consist of the page_load and the ItemDataBound
[Code]....

View 3 Replies

Linq To XML - Getting Correct Query Result, But It's Buried Deep In The Result Var?

Mar 1, 2011

I'm having a problem with my Linq to XML query. I'm getting the result data I want, but it's nested so deep that there must be a better way.Here is my XML:

[Code]....

I'm trying to get a list (simple string[]) of all Item IDs where Category Names contains "Other".Here is my Linq:

[Code]....

[Code]....

Here is a snapshot of my result from Visual Studio:The results I want are there ("item100", "item400", "item500"), but buried so deeply in the results var.

How can I get the query to return a simple

string[] = { "item100", "item400", "item500" }

View 4 Replies

SQL Server :: An Example Of CTE Result Being Again Used In A CTE?

Dec 3, 2010

I am looking for an example where I create CTE, and then using the result of first CTE, I create another CTE.With CTE1 as ( Col1, Col2, Col3)

(
--SOME RECURSIVE QUERIES
)

select Col1, Col2, Col3 from CTE1 where Col3 >100I want to now use the above query inside a recursive CTE2. One way is to store the above result in a temp table and use the temp table in a new CTE but I am NOT looking for temp table solution here. May be wrap the above result in another CTE, but I am missing the syntax.

View 5 Replies

SQL Server :: Get SUM Of The Result?

Dec 27, 2010

I have the following request:

[Code]....

its result is:

ProductSUM
1355
310
210
220
150
95
60
235
90
545

How to SUM these values?

View 5 Replies

C# - Implement System.Web.Caching.Cache Object In A Controller To Cache Specific Query?

Mar 29, 2010

Is it correct to implement my caching object like this in my controller :

[code]....

And I Use it like this :

[code]....

View 1 Replies

Architecture :: Cache The Full List Of Objects In Http Cache On The Service Tier And Page In Memory?

Feb 25, 2011

We have a wfc layer that wraps the business classes and database access and use a client that lives on the database layer. Amongst our group we are attempting to form standards. Some want to have the client call the web method and pass the page they are requesting and the page size. Pass that to the database and then page in SQL Server use RowNum.Some want to cache the full list of objects in http cache on the service tier and page in memory. They concern here is memory use on the server.

Which would be best for a medium number of users with potentially large number of records to manage (say 30K) Is it better to cache them all in memory and work from there or page at the database as the application scales?

View 1 Replies

New-Cache Parameters For AppFabric Cache When Storing.NET Session State

Jul 28, 2010

What are the "optimal" parameters for creating an AppFabric cache when you will be storing session state in the cache? MSDN Cache-Related Commands

Powershell command line:

New-Cache [-CacheName] <String> [-Eviction <String>] [-Expirable <String>] [-Force [<SwitchParameter>]] [-NotificationsEnabled <String>] [-Secondaries <Int32>] [-TimeToLive <Int64>]

[code]...

Since I don't want my sessions to be removed unless the session has been abandoned either via code or Session Timeout...For eviction, I would think "None" and for expireable, I would think False.I have tested and calling Session.Abandon does remove the object from the cache. I have also tested to see if by extending my session, the session object in cache is also extended. This does seem to work the "correct" way.

View 1 Replies

Data Cache Support Background Population Of Cache Entries?

Aug 1, 2010

We have a data driven ASP.NET website which has been written using the standard pattern for data caching (adapted here from MSDN):

public DataTable GetData()
{
string key = "DataTable";
object item = Cache[key] as DataTable;

[code]...

The trouble with this is that the call to GetDataFromSQL() is expensive and the use of the site is fairly high. So every five minutes, when the cache drops, the site becomes very 'sticky' while a lot of requests are waiting for the new data to be retrieved.

What we really want to happen is for the old data to remain current while new data is periodically reloaded in the background. (The fact that someone might therefore see data that is six minutes old isn't a big issue - the data isn't that time sensitive). This is something that I can write myself, but it would be useful to know if any alternative caching engines (I know names like Velocity, memcache) support this kind of scenario. Or am I missing some obvious trick with the standard ASP.NET data cache?

View 3 Replies

C# - Maximum Length Of Cache Keys In HttpRuntime.Cache Object?

Feb 24, 2010

We are using HttpRuntime.Cache API in an ASP.NET to cache data retrieved from a database.

For this particular application, our database queries feature a LOT of parameters, so our cache keys look something like this:

table=table1;param1=somevalue1;param2=somevalue2;param3=somevalue3;param4=somevalue4;param5=somevalue5;param6=somevalue6... etc...

we have so many parameters that the cache key is several hundred characters long. is there a limit to the length of these cache keys? Internally, it is using a dictionary, so theoretically the lookup time should be constant. However, I wonder if we have potential to run into some performance/memory problem.

View 1 Replies

ADO.NET :: Use HttpContext.Current.Cache (system.web) For Cache Data Something In Project

Sep 13, 2010

I have use Nhibernate in my MVC Project by me known, Nhibernate have cache on Session and Object. now, I want use HttpContext.Current.Cache (system.web) for cache data something in project. my code same that have problem, haven't it. and that's right or wrong.

View 2 Replies

SQL Server :: How To Bring Distinct Result

Jan 5, 2011

I need to bring the distinct result in third columnBelow one is my sample table

[Code]....

View 19 Replies

SQL Server :: Retrieve Date - Zero Result

Aug 4, 2010

I am using datetime.now in vb.net to retrieve the current time and date. I passed this parameter into this dim strDate as datetime

strDate = datetime.now

I then saved this strDate into database. However, when I want to retrieve the following date with example, say 2/8/2010 3:58:58 PM

SELECT * FROM CUST WHERE DATE = '2/8/2010 3:58:58 PM'

the result is 0. So i went to SELECT * FROM CUST and realized that the date in the Date column is this:

2010-08-04 15:58:20.000

I have retrieve today's date and saved into database, by right the format should be the same.. May I know what has happened?

View 8 Replies

SQL Server :: Inner Join Get Duplicate Result?

Feb 7, 2011

I have table with 'usercard' name , and a related tables :

- Computer

- Laptop

- Fax

- UPS

Now , Every Employee has one or more than one from these devices , When I used INNER JOIN in my select query , I didn't get what I need

the result show a one user in 4 rows,(user have all devices)

View 13 Replies

Is Page Output Cache Stored In.NET Cache Object?

Nov 2, 2010

I need to enable caching in my asp.net application, but I do not want to use the webserver's memory for holding cache objects. If I add the page directive for output caching will the page be stored in the asp.net cache object?

View 2 Replies

C# - Application_End() Cannot Access Cache Through HttpContext.Current.Cache

Dec 12, 2010

I want to be able to maintain certain objects between application restarts.

To do that, I want to write specific cached items out to disk in Global.asax Application_End() function and re-load them back on Application_Start().

I currently have a cache helper class, which uses the following method to return the cached value:

return HttpContext.Current.Cache[key];

Problem: during Application_End(), HttpContext.Current is null since there is no web request (it's an automated cleanup procedure) - therefore, I cannot access .Cache[] to retrieve any of the items to save to disk.

Question: how can I access the cache items during Application_End()?

View 4 Replies

SQL Server :: Query - How To Make Total Sum Of The Result

Nov 3, 2010

this script work with join and sum

and works good,but i want to make total sum of the result of this query for all rows of sum column

[Code]....

View 4 Replies

C# - Is The Result Of A Md5 Hash Consistent Or Server Dependent

Mar 12, 2010

I am doing a md5 hash, and just want to make sure the result of:

md5.ComputeHash(bytePassword);

Is consistent regardless of the server?

e.g. windows 2003/2008 and 32/64 bit etc.

View 4 Replies

SQL Server :: How To Store Query Result In Variable

Oct 7, 2010

i am wishing to store the query result in any variable, have look at below code.

[Code]....

I have marked the code with bold, where I am getting error.

how do I store query result in any variable.

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved