Testing Query Performance - Clear Out Cache

Apr 3, 2006

I am trying to improve the performance of a query. No matter how bad
it runs the first time, it runs really fast the second time.

So how can I tell if I've done anything to improve the query if it
always comes back quickly after the first run? I assume the
query/data/plan is in cache - how can I clean it out for my session?

Thanks in advance for any help you can provide -

View 4 Replies


ADVERTISEMENT

How Do U Clear Cache In SQL

Dec 14, 2006

How do u clear Cache in SQL

if i run a query once it takes 10 seconds and if i run the same query again it takes 1 second because it is cached. So i want to know how i can clear it because i want do some benchmarking on a query that is in cache

View 5 Replies View Related

SQL 2012 :: When Does Database Clear Buffer Cache

Sep 28, 2015

We are troubleshooting a performance problem and the test result is slow the 1st time but the subsequent runs are faster.. Logging out of application and log back in ( connecting to a new database session) did not clear the buffer cache as I thought it would.. When does the database clear the buffer cache? Is it not per database session?

I can issue CHECKPOINT and then run DBCC DROPCLEANBUFFERS to clear the buffers in the disk. But since we are testing from the application,do we need to run these commands via application code to clear buffer/per database session OR can we run these commands from a management studio session?

View 8 Replies View Related

SQL 2012 :: Clear Procedure Cache Of A Single Procedure?

Sep 12, 2014

Is there anyway to clear the procedure cache of a single procedure?

View 9 Replies View Related

Performance Testing

Feb 20, 2008



can any one guide me how should i do performance testing on database size for sql server.
I dont know how to read the execution plan, though i have read many document but still i am not clear.
For are the reports which shows the performance has been down and its all accurate.

View 26 Replies View Related

Performance Testing Accepted Value

Mar 4, 2008





Measurement min ave max
% Disk Time (PhysicalDisk _Total): 0.053 1.863 63.109
% Processor Time (Processor _Total): 0.0 37.543 98.84
Average Latch Wait Time (ms) (SQLServer|Latches): 0.0 1.537 16
Average Wait Time (ms) (SQLServer|Locks _Total): 0.0 0.193 16
Current Disk Queue Length (PhysicalDisk _Total): 0.0 0.365 67
Log Growths (SQLServer|Databases _Total): 0.0 0.0 0.0
Page Faults/sec (Memory): 9.206 172.064 8612.257
Pages/sec (Memory): 0.0 7.313 815.411
Pool Nonpaged Bytes (Memory): 38195200 38352765.277 38547456
Private Bytes (Process _Total): 1516933120 1663239600.632 1785290752
Processor Queue Length (System): 0.0 0.489 17
Threads (Objects): 922 938.353 950



can anyone tell me what is the accepted value for performance on sql server 2005
this report is generated from mercury load runner

View 1 Replies View Related

L2 Cache For Performance

Oct 30, 2001

Microsoft recommends a 1MB L2 processor cache for SQL2000. I only have a 256K cache. What is the impact and what can I do, other than replace my procs, to compensate.

Thanks in advance.

View 1 Replies View Related

Performance Monitor -- Buffer Cache Object

Jul 2, 2007

Hello,
Does the performance counter Buffer cache object refer to Data cache and procedure cache or just refers to Data cache???

I was of the opinion that Buffer cache means data cache and Plan cache means procedure cache. Can someone throw some light???

Regards

Jaideep

View 4 Replies View Related

Not Clear About This Query

Jul 20, 2005

select *From titles(18 row(s) affected)Totally 18 records are there in Titles table.When I queryselect title,title_id From titles where title like 'T%' and title_idlike 'M%'It is returning 2 records.So,now if I introduce a not in 2 places also it should return 16records.Whereas it is returning 14 records. What is the bestway to understandthis.select title,title_id From titles where title not like 'T%' andtitle_id not like 'M%'ThanksGanesh

View 2 Replies View Related

Query Plan In Clear Text

Dec 11, 2005

hi.coming from postgresql, i am used to textual references to most of thethings i do with the database. i feel a little lost with all the graphical.i have few questions regarding MS SQL 20001. what is the best (or easiest) way of getting a table definition in text?it could be either a CREATE TABLE sql-query or a just a definition,something like:TABLE thisTableidintegervaluevarchar(10)etc.etc.2a. how do i get a query plan and how do i get it in text.2b. are there planner modes that show more or less of what actuallyhappened, verbose mode perhaps?2c. if i ask for a query plan, will SQL server actually run the query orwill it only produce a plan. if the query is run, does it commit orrollback by default?stig

View 7 Replies View Related

Need Help With Testing Query In Asp.

Dec 6, 2005

hello everyone i was hoping to get some help.
i have sql server2000 and iis5.1 running and im using vbscript through asp.
i have a table that has two keys so that together they make a unique key.
so i am trying to test my table in asp so that if there is a duplicate unique key inserted then show an
error...
Can anyone help me?

View 5 Replies View Related

Testing A Query?

Aug 1, 2007

i've been informed that one way to test a query is to execute and roll-back it back as a transaction. my question is the following: using the aforementioned mechanism, how can i examine the database state before the query is rolled-back?

View 2 Replies View Related

Unable To Connect To SQL Database 'MySite-Cache' For Cache Dependency Polling.

Dec 27, 2007

 Im getting this error when trying to set up a cache dependency...are there any special permissions etc?From CS:SqlCacheDependency dep = new SqlCacheDependency("MySite-Cache", "Products");Cache.Insert("Products", de.GetAllProductsList(), dep); From connectionStrings.config:<add name="SiteDB"         connectionString="Data Source=localhost,[port]SQLEXPRESS;Integrated Security=true;User Instance=true; AttachDBFileName=|DataDirectory|ASPNETDB.MDF" providerName="System.Data.SqlClient" />Also tried this using my machinename<add name="SiteDB"         connectionString="Data
Source=<machinename>,[port]SQLEXPRESS;Integrated Security=true;User
Instance=true; AttachDBFileName=|DataDirectory|ASPNETDB.MDF"
providerName="System.Data.SqlClient" /> From web.config:       <caching>          <sqlCacheDependency enabled="true" pollTime="10000">              <databases>                  <add name="MySite-Cache" connectionStringName="SiteDB" pollTime="2000"/>              </databases>          </sqlCacheDependency>                </caching> EDIT: So making progress I can't seem to get the table registered for cache dependency:The sample i have says"aspnet_regsql.exe -E -S .SqlExpress -d aspnetdb -t Customers -et"and the command line response is "Enabling the table for SQL cache dependency..An error has happened.  Details of the exception:The table 'Customers' cannot be found in the database."Where does this "Customers" table come from? There is obviously not an application specific "Customers" table in aspnetdb I'm confused probably more by the example than anything.... 

View 3 Replies View Related

SQL2K - Clean Buffer Cache And Procedure Cache.

May 31, 2007

Is there a way to drop clean buffers at the database level instead of the server/instance level like the undocumented €œDBCC FLUSHPROCINDB (@dbid)€??
Is there a workaround for €œdbo€? to be able to flush procedure and data cache without being elevated to €œsysadmin€? server role?

PS: I am aware of the sp_recompile option that can be used to invalidate cached execution plans.
Thx.

View 1 Replies View Related

Null Testing In Select Query

May 9, 2007

I am obviously a newbie to SQL Server but have been using Access for years and I have come up against what appears to be an age old issue concerning nulls and specifically the functions to test for them etc.

Below is the Access Query I am having difficulty with...
----------------------------------------------------------
SELECT DISTINCT Max(tbl_ScheduleDate.SchDate) AS CurrentDate, ([SchDate],"mmmm yyyy") AS MonthYear, tbl_Schedule.Area, tbl_Schedule.CP, IIf(IsNull(tbl_tmp_CP.CPID),"Not Uploaded","Uploaded") AS Loaded

FROM (tbl_Schedule INNER JOIN tbl_ScheduleDate ON tbl_Schedule.MaxMinID = tbl_ScheduleDate.MaxMinID) LEFT JOIN tbl_tmp_CP ON tbl_Schedule.CP = tbl_tmp_CP.CP

GROUP BY Format([SchDate],"mmmm yyyy"), tbl_Schedule.Area, tbl_Schedule.CP, IIf(IsNull(tbl_tmp_CP.CPID),"Not Uploaded","Uploaded"), tbl_ScheduleDate.SchDate, tbl_tmp_CP.CPID;
-------------------------------------------------------------

Ignore the Format() function as I know this is a problem and have a fix.

The problem is this field...
IIf(IsNull(tbl_tmp_CP.CPID),"Not Uploaded","Uploaded") AS Loaded

I am testing to see if data is loaded into table 'tbl_tmp_CP' that is related to 'tbl_Schedule' by checking if there is a null value or not and then adding the right response string value to a column called Loaded.

Can anyone suggest a way for me to do the above?

View 2 Replies View Related

Query Cache?

Jul 20, 2005

Does SQL Server have a query cache similar to mysql, whereas the queryresult is cached, if the table has not been changed?If so, please refer me to more info.Thanks.--http://www.dbForumz.com/ This article was posted by author's requestArticles individually checked for conformance to usenet standardsTopic URL: http://www.dbForumz.com/General-Dis...pict170423.htmlVisit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=571428

View 1 Replies View Related

Flush Query Cache

Nov 2, 2005

Is there a clean way to flush the query cache so I can simulate the first execution of an SQL statement any time I want to?

View 3 Replies View Related

See Query Text From Cache

Mar 22, 2006

Hi,

During a trace in profiler, I see some lines that indicate :
exec sp_execute 12
Or
exec sp_execute 24

I suppose these are query in cache and are recall by query processor ? If yes, how can I see this query in clear text ?

Thanks for help

View 2 Replies View Related

How To Disable Query Cache?

May 8, 2008

Hello,

I need to disable query cache in MS SQL Server 2005 Express. How can i do it?
My application can opertate ~2K records per sec (INSERT).
A million records costa me extra 142 Mb of RAM.
It means that sql server will take exrta 1Gb of RAM every hour.
I can't afford that.
Can anyone please help me?

View 8 Replies View Related

Sys.dm_os_memory_cache_counters Vs. SQL Server:Plan Cache Cache

Feb 15, 2008

Hi guys,

I am looking at the plan caches/cached pages from the perspective of
sys.dm_os_memory_cache_counters and sql serverlan Cache - Cache Pages

For the first one I am using

select (sum(single_pages_kb) + sum(multi_pages_kb) )
from sys.dm_os_memory_cache_counters
where type = 'CACHESTORE_SQLCP' or type = 'CACHESTORE_OBJCP'
a slight change from a query in
http://blogs.msdn.com/sqlprogrammability/

For the second just perfmon.

The first one gives me a count of about 670,000 pages only for the object and query cache and the second one gives me a total of about 100,000 pages for five type of caches including object and query.

If I am using the query from http://blogs.msdn.com/sqlprogrammability/ to determin the plan cache size

select (sum(single_pages_kb) + sum(multi_pages_kb) ) * 8 / (1024.0 * 1024.0) as plan_cache_in_GB
from sys.dm_os_memory_cache_counters
where type = 'CACHESTORE_SQLCP' or type = 'CACHESTORE_OBJCP'

it gives me about 5 GB when in fact my SQL Server it can access only max 2GB with Total and Target Server Memory at about 1.5 GB.

Does anyone have any idea what is going on?

View 2 Replies View Related

Connection Pooling Problem - Testing/query Tools?

Feb 23, 2008

I have an application that is using ADO connection strings from multiple clients. One site with about 20 users was recently upgraded to a newer version of my application, and the number of connections to the SQL Server I'm told went from about 20 to spiking over 100 from time to time. There were myriad changes to my app over the course of the last year since their prior version of my app. I need to nail down which version introduced a change in connection pooling (?) and I was wondering what tools I should use to monitor that.

Any ideas?

View 1 Replies View Related

How Always Keep Specific Query In Procedure Cache ?

Jun 1, 2001

Is any way we can tell sql server to keep specific (long runing) query in procedure Cache.
I already tried to do this by creating job (run every 1 hr from 8 am to 6 pm)
but is not enough

Thanks

View 1 Replies View Related

Clearing Of Cache In Query Analyser

Apr 3, 2002

HI

May I know how to clear the cache area in the analyser as I need to
know the time taken for execution of an sql statement(query) before
and after creation of indexes.



tia
MK

View 1 Replies View Related

SQL 2012 :: Query Notifications For More Than Just Cache?

Jan 13, 2015

All the recommendations I see from Microsoft docs is to limit the use of Query Notifications (QNs) to notifying connected clients when changes to mostly-static reference or configuration data occur, and to keep the number of overall query forms in play and connected clients to a minimum. Any way regarding a more integral use of QNs and Service Broker from a web app to notify n-web servers (farm) of an update to data that could be updated concurrently and quite frequently, or with a system where the technique is used extensively with lots of different query forms?

View 0 Replies View Related

DB Engine :: How To Use Particular Query In Buffer Cache Permanently

Aug 3, 2015

I've a spatial (GIS) Data which is used frequently insertion, updation.

5 lakh records insertion in daily basis. when I trying to generate reports last 3 days or one weak, it takes 20-30 minute.

very disappointing while playing with clients. how to boostup and perform fast.

I think as so once we set query plan in buffer permanently then i would be faster than ever.

View 4 Replies View Related

Extremely Poor Query Performance - Identical DBs Different Performance

Jun 23, 2006

Hello Everyone,I have a very complex performance issue with our production database.Here's the scenario. We have a production webserver server and adevelopment web server. Both are running SQL Server 2000.I encounted various performance issues with the production server with aparticular query. It would take approximately 22 seconds to return 100rows, thats about 0.22 seconds per row. Note: I ran the query in singleuser mode. So I tested the query on the Development server by taking abackup (.dmp) of the database and moving it onto the dev server. I ranthe same query and found that it ran in less than a second.I took a look at the query execution plan and I found that they we'rethe exact same in both cases.Then I took a look at the various index's, and again I found nodifferences in the table indices.If both databases are identical, I'm assumeing that the issue is relatedto some external hardware issue like: disk space, memory etc. Or couldit be OS software related issues, like service packs, SQL Serverconfiguations etc.Here's what I've done to rule out some obvious hardware issues on theprod server:1. Moved all extraneous files to a secondary harddrive to free up spaceon the primary harddrive. There is 55gb's of free space on the disk.2. Applied SQL Server SP4 service packs3. Defragmented the primary harddrive4. Applied all Windows Server 2003 updatesHere is the prod servers system specs:2x Intel Xeon 2.67GHZTotal Physical Memory 2GB, Available Physical Memory 815MBWindows Server 2003 SE /w SP1Here is the dev serers system specs:2x Intel Xeon 2.80GHz2GB DDR2-SDRAMWindows Server 2003 SE /w SP1I'm not sure what else to do, the query performance is an order ofmagnitude difference and I can't explain it. To me its is a hardware oroperating system related issue.Any Ideas would help me greatly!Thanks,Brian T*** Sent via Developersdex http://www.developersdex.com ***

View 2 Replies View Related

SQL Server 2012 :: Query Tuning With Each Run Of Fresh / Blank CACHE

Jun 4, 2015

I am using SQL Server 2012 Express.

I am doing performance tuning of SP/Query in Dev-Test environment.

I found that SQL Server caches plan between successive executions.

So if I test/execute SP 10 times, after 1st or 2nd execution, SQL server will pull-up plan-info from CACHE...Not from SQL SERVER Or Database...

Means i am not getting correct answer...

I found this 2 commands:

DBCC FREEPROCCACHE

DBCC DROPCLEANBUFFERS

But they say that executing above command might interfere/bother other people executing other query/sp on this server.

They also say that: Freeing the plan cache causes, for example, a stored procedure to be recompiled instead of reused from the cache. This can cause a sudden, temporary decrease in query performance.

Part of query was using Dynamic-SQL executed with EXEC command.

I replaced that with SP_EXECUTESQL.

How can I start testing of each SP-run with Fresh/Blank CACHE ?

View 1 Replies View Related

SQL 2012 :: Buffer Cache And PLE (Page Life Expectancy) Query

Aug 17, 2015

I'm getting an alert which states that both my Buffer Cache Hit Ratio and PLE are low on one of my SQL Servers though I'm not sure how to correctly check this.

I ran:

SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Buffer Manager%'
AND [counter_name] = 'Buffer cache hit ratio'

Which gives me the Buffer Cache Hit Ratio, cntr_Value of 9 though its constantly dipping between 3-3000 and is never steady and I'm unsure if this is normal.

I also ran:

SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Buffer Manager%'
AND [counter_name] = 'Page life expectancy'

Which gives me the Page life expectancy of 209061.

If these values would cause concern and if this is a normal Buffer Cache Hit Ratio? It's constantly dropping from high or low from what I can see. These scripts were pulled from another forum and I'm assuming they're showing the correct values.

View 1 Replies View Related

Can You Cache A SSIS Lookup Component To Foxpro V7 With Parameterized Query?

Feb 24, 2006

I am using a lookup component in a SSIS data flow. The lookup is a select to a foxpro table. THe lookup works fine with full cache selected. I cannot get the lookup to work with a partial or no cache. I have the latest Foxpro OLE DB driver installed which I understand to support paramaterized queries. Has anyone had success with using cached lookup to Foxpro? Does anyone know how to set the lookup properties of sqlcommand and sqlcommandparam? I am unable to find any examples in BOL or on the web.

Here are some details. IF I go with "use a table or a view" option with the default cache query I get initialization errors

[lkp_lab_worst_value [6170]] Error: An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft OLE DB Provider for Visual FoxPro" Hresult: 0x80040E14 Description: "Command contains unrecognized phrase/keyword.".

In the advanced editor I see

SQLCommand set to

"select * from `kcf`"

and SQLCommandParam set to

"select * from
(select * from `kcf`) as refTable
where [refTable].[patkey] = ? and [refTable].[dayof_stay] = ? and [refTable].[modifier] = ? and [refTable].[kcf_code] = ? and [refTable].[source] = ? and [refTable].[kcf_time] = ?"

I believe the above error is because Foxpro V7 does not support the inner subselect . In addition the query contains CRLF without a continuation character (";").

If I remove the CRLF in the sqlcommandparam query, using the advanced editor, I get this design time error "OLE D error occurred while loading column metadata. Check the sqlcommand and sqlcommandparam properties". The designer requires both properties to be set, its unclear to me how the interact.

I cannot find any examples in BOL or on the web on how to set these 2 properties. Can someone give me a few guidelines?

I can get past the design errors by changing sqlcommandparam to a plain select that is VFP 7 compatible ( I removed the subselect and the square brackets):

select * from kcf as refTable where refTable.patkey = ? and refTable.dayof_stay = ? and refTable.modifier = ? and refTable.kcf_code = ? and refTable.source = ? and refTable.kcf_time = ?

But then I get a runtime error

[lkp_lab_worst_value [6170]] Error: An OLE DB error has occurred. Error code: 0x80040E46. An OLE DB record is available. Source: "Microsoft OLE DB Provider for Visual FoxPro" Hresult: 0x80040E46 Description: "One or more accessor flags were invalid.".

[lkp_lab_worst_value [6170]] Error: OLE DB error occurred while binding parameters. Check SQLCommand and SqlCommandParam properties.

Any idea on what I should try next ?

View 3 Replies View Related

SQL Server 2008 :: Is Only One Plan Is Kept For One Query In Plan Cache

Mar 14, 2015

Is only one plan is kept for one query in plan cache?

i heard generally hash is created for a query and plan is search with this hash.

View 2 Replies View Related

Still Not Clear

Jul 23, 2005

hi thank you for this solution Hugo (dutch?) and it's very handy, thankyou but my issue is that we created dozens of views with my function.This functions returns an integer of a date. This function has to give alowerlimit and higherlimit back when dates are out of Calendar range.But i want to read this from the Calendartable ONCE and store it in aglobal variable somewhere in SQL Server. I DON'T want to referencetables in my function. SO read once the lower- and upperlimit and usethis variable/property for referencing in my function!!GreetzHennie*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 11 Replies View Related

Cache Hit Ratio Vs Buffered Cache Hit Ratio

Mar 13, 2003

On Microsoft performance monitor, what is the difference between SQL Server Cache Manager: Cache Hit Ratio and SQL
Server Buffer Manager: Buffer Cache Hit Ratio? We have a production server where the buffer cache hit ratio is
consistently at 99%, which is normal. However, the cache hit ratio is 73%. What is the difference between the two
hit ratios, and why would we have such a significant difference between the two?

Any help or advice would be much appreciated.

View 5 Replies View Related

How To Clear Table?

Jul 10, 2006

Is there a way to clear all the records in a table in Microsoft SQL
Server Management Studio instead of selecting all the rows and delete?

View 12 Replies View Related







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