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
Similar Messages:
Jan 6, 2010
I have a table that contains a date column along with others. I need to extract two sets of data from this table for two different time periods. Call them Current and Previous, so that I can compare them line for line. There are exactly the same number of days in both time periods.
The problem is that I need to return the data like this:
CurrentDate, Count(CurrentItems), Sum(Amt), Count(PreviousItems), Sum(PrevAmt)
JOIN puts the data into the result vertically, so that doesn't work. So far, I have not found a method that will arrange the data correctly.
View 1 Replies
Jun 12, 2010
Just after some advice I have a stored procedure that returns several tables. I then need to loop through the tables and create dynamic gridviews using the data. At the moment this stored proc is called using
[Code]....
I have used an xsd file to populate everthing else, but due to this returning multiple tables i wasn't sure how this works should it just be in its own xsd? as all the oather i just get a datatable where as with this i need a dataset... how this makes sense...
View 2 Replies
Feb 18, 2010
I had requirement that i need to display four charts in one report. The data for the report is given through stored procedure. In this stored procedure each chart have its own result set. ie., the Stored Procedure is returning four result sets.
View 2 Replies
Apr 9, 2010
I'm trying to develop a small application that test how many requests per second can my service support but I think I'm doing something wrong. The service is in an early development stage, but I'd like to have this test handy in order to check in time to time I'm not doing something that decrease the performance. The problem is that I cannot get the web server or the database server go to the 100% of CPU.
I'm using three different computers, in one is the web server (WinSrv Standard 2008 x64 IIS7), in other the database (Win 2K - SQL Server 2005) and the last is my computer (Win7 x64 ultimate), where I'll run the test. The computers are connected through a 100 ethernet switch. The request POST is 9 bytes and the response will be 842 bytes.
The test launches several threads, and each thread has a "while" loop, in each loop it creates a WebRequest object, performs a call, increment a common counter and waits between 1 and 5 millisencods, then it do it again:
static Int32 counter = 0;
static void Main(string[] args)
{
ServicePointManager.DefaultConnectionLimit = 250;
[Code]....
If I run the test neither of the computers do an excesive CPU usage. Let's say I get a X requests per second, if I run the console application two times at the same moment, I get X/2 request per second in each one... but still the web server is on 30% of CPU, the database server on 25%...
I've tried to remove the thread.sleep in the loop, but it doesn't make a big difference.
I'd like to put the machines to the maximun, to check how may requests per second they can provide. I guessed that I could do it in this way... but apparently I'm missing something here...
View 3 Replies
Feb 3, 2011
I am using a sql stored procedure which returns multiple result sets. By default Sql Datasource is binding the first result set to gridview. I want the second result set to be binded. I browsed all the properties in Sql datasource but could not find one to set this.
View 4 Replies
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
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
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
Jun 4, 2010
Would it be better to have a sp return multiple result sets and use NextResult() or have subsequent call to dr.execute.... () and hadle one result at a time?
To me using nextResult() on a multiresult datareader would be cleaner and easier - but it does not seem to be very "atomized". I guess I am wondering can the cost of executing multiple commands be neglected? Seems like executing multiple commands and receiving a single result set would also be easier to read/test/understand.
View 1 Replies
Oct 7, 2010
I have a complicated report that nests six deep and so really hits the database hard. I want to use SqlDataReaders NOT DataAdapters and DataSets because I don't want big tables in memory.
MARS can get me the data fast, all from the one connection. But all the examples show it binding to a treeview.
I want to bind it to nested GridViews (six deep!).
Any examples of MARS binding to nested gridview/list/repeater controls of any kind?
View 1 Replies
Apr 12, 2010
I am a web designer and usually design corporate web sites which often does not require update. So I want to cache the output for one day. How can I do this?
View 4 Replies
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
Feb 1, 2011
I am trying to display this query result in an aspx page.
It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)
select
top 500
--This column is the issue
,Governing_Class=( case when exists (select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380')
order by tqcm.premium_amt desc
)
then ( select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.
appid
order by tqcm.premium_amt desc
)
......... From tables
View 7 Replies
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
Nov 4, 2010
i have tow query in one stored procedure
first query and the second one every of them return only value
i want to copy the result of tow values in a new row in new table
as i want to check on this tow values in ado.net
i want to get only this tow values as a row not first and secon query
only a row has result of first and second query results
[Code]....
View 3 Replies
Jun 23, 2010
When i create a sql script in the Query Builder (going through the wizard in a DataSet) the Query Builder window is to small for me. Is there a way to maximize this window by default?PS, I have previously posted this in the forum "Visual Studio 2008.
View 2 Replies
Nov 10, 2010
I am building a web application where i am using multilingual support.
I am using variable for label text display.so that administrator can change in one area and that text reflects throughout the application.
which is better less time consuming for display label text?
1)using relational db interaction.
2)constant variable.
3)xml interaction.
how could I found/calculate the processing time of the above three.
View 2 Replies
Oct 25, 2010
Currently, I have long script which does major processing and then puts data into temp table.
Finally I read data from this temp table to show on the chart, based on user's selection of parameter. So I can divide my query into two parts and while I am researching this,
Is it possible to do processing in one Datasource and read table from second datasource?Is it even possible?
If not, what is recommended method for this (breaking large processing into small one)?
View 2 Replies
Jul 19, 2010
How to increase the performance of query in sql server2008
View 4 Replies
Oct 21, 2010
I use slqce database to store master-detail table.It took too long to insert byte array data. how to improvement the query performance?
View 2 Replies
Dec 6, 2010
I have database with 40 big tables.In each stored procedure query is containing minimum 6 joins.The query is taking too much time to execute.I didn't implemented views and indexes.
View 2 Replies
Feb 27, 2011
how to check query performance in sqlserver 2008 r2
View 1 Replies
Mar 11, 2011
isnt there performance analysis tools that i can use to monitor and trouble shoot things like timeout expired (slow query execution)?
I mean is there a way for me to monitor the query performance as it is run from the webpage. It runs perfectly in the SMS but it's slow when it's running from the webpages so it throws Timeout expired exception.
View 7 Replies
Feb 9, 2011
I use the follwoing code to get a value from the SQL query. But now i would like to use some sql function like Sum() count() ... and i would like to get the result of that.
vb Code:
Dim constg As New SqlConnection
constg.ConnectionString = "Data Source=m......."
constg.Open()
Dim payrollquery As String '= ("SELECT * FROM xxxxx.nnnnn WHERE ID IN(" & ID & " ) AND sent = 'U' ")
Dim cmd3 As New SqlCommand(sqlstr, constg)
Dim reader As SqlDataReader = cmd3.ExecuteReader
View 3 Replies