Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

how to made adhoc query cached?
Hi,
I have a problem with performance of ADHOC query like "exec sp_Name
par1=@par1 ... parN=@parN". I know that there are prox. 50 different kinds o
f
the query ( with different parameter value ). I found in syscacheobjects onl
y
20% of cases. And most heavy query is not cached at all. The execution time
of this particular query is 10 times more than if it was cached. Do somebody
know how to made sqlserver to cache particular adhoc query?
Thanks.


Report this thread to moderator Post Follow-up to this message
Old Post
Leo
03-30-05 02:40 PM


Re: how to made adhoc query cached?
Leo
Did you see an execution plan of the query? Did the optimizer
use any indexes defined on the tables?
How big are your tables?
How many rows do you want to retrieve?






"Leo" <Leo@discussions.microsoft.com> wrote in message
news:80BD14F0-FF7A-43C7-BBE6- F7C241889597@microso
ft.com...
> Hi,
> I have a problem with performance of ADHOC query like "exec sp_Name
> par1=@par1 ... parN=@parN". I know that there are prox. 50 different kinds
of
> the query ( with different parameter value ). I found in syscacheobjects
only
> 20% of cases. And most heavy query is not cached at all. The execution
time
> of this particular query is 10 times more than if it was cached. Do
 somebody
> know how to made sqlserver to cache particular adhoc query?
> Thanks.
>



Report this thread to moderator Post Follow-up to this message
Old Post
Uri Dimant
03-30-05 02:40 PM


Re: how to made adhoc query cached?
Of cource, I saw the plan under query analizer, and this plan quite satisfy 
me.
The problem is that the application sometimes use another plan. The query in
plan I see in QA uses tables indexes. The size is not very big - less than
100K records,
but query uses aggregations.


"Uri Dimant" wrote:

> Leo
> Did you see an execution plan of the query? Did the optimizer
> use any indexes defined on the tables?
> How big are your tables?
> How many rows do you want to retrieve?
>
>
>
>
>
>
> "Leo" <Leo@discussions.microsoft.com> wrote in message
> news:80BD14F0-FF7A-43C7-BBE6- F7C241889597@microso
ft.com... 
> of 
> only 
> time 
> somebody 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Leo
03-30-05 02:40 PM


Re: how to made adhoc query cached?
Leo
So , does it meant that query optimizer was available to use indexes?
Can you post your query and how you call it ?



"Leo" <Leo@discussions.microsoft.com> wrote in message
news:B453A794-56BE-49AC-82E7- C117DDABC73E@microso
ft.com...
> Of cource, I saw the plan under query analizer, and this plan quite
satisfy me.
> The problem is that the application sometimes use another plan. The query
in
> plan I see in QA uses tables indexes. The size is not very big - less than
> 100K records,
> but query uses aggregations.
>
>
> "Uri Dimant" wrote:
> 
 kinds
 
 syscacheobjects[colo
r=darkred] 



Report this thread to moderator Post Follow-up to this message
Old Post
Uri Dimant
03-30-05 02:40 PM


Re: how to made adhoc query cached?
It is nice of you , Uri to prompt me to find out the problems from source.
But I afraid it is impossible - the size of procedure is 17 kB and it is
really complicated :)
My question is how make sqlserver put the plan of this procedure to cache.
When I call dbcc freeproccache then call my procedure , it is goes to cache,
but after server restart and cache clearing it is disappiared. I need some
predictable behavior and want it always be in cache.

Thank you once more for assistance.

Leo

"Uri Dimant" wrote:

> Leo
> So , does it meant that query optimizer was available to use indexes?
> Can you post your query and how you call it ?
>
>
>
> "Leo" <Leo@discussions.microsoft.com> wrote in message
> news:B453A794-56BE-49AC-82E7- C117DDABC73E@microso
ft.com... 
> satisfy me. 
> in 
> kinds 
> syscacheobjects 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Leo
03-30-05 02:40 PM


Re: how to made adhoc query cached?
You can create an autostart procedure from which you execute this stored pro
cedure. See
sp_procoption.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
http://www.sqlug.se/


"Leo" <Leo@discussions.microsoft.com> wrote in message
news:63F79347-2F0F-4F76-B318- 77C3AEC167B2@microso
ft.com...
> It is nice of you , Uri to prompt me to find out the problems from source.
> But I afraid it is impossible - the size of procedure is 17 kB and it is
> really complicated :)
> My question is how make sqlserver put the plan of this procedure to cache.
> When I call dbcc freeproccache then call my procedure , it is goes to cach
e,
> but after server restart and cache clearing it is disappiared. I need some
> predictable behavior and want it always be in cache.
>
> Thank you once more for assistance.
>
> Leo
>
> "Uri Dimant" wrote:
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
03-30-05 02:40 PM


Re: how to made adhoc query cached?
Thanks

"Tibor Karaszi" wrote:

> You can create an autostart procedure from which you execute this stored p
rocedure. See
> sp_procoption.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/
> http://www.sqlug.se/
>
>
> "Leo" <Leo@discussions.microsoft.com> wrote in message
> news:63F79347-2F0F-4F76-B318- 77C3AEC167B2@microso
ft.com... 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Leo
03-31-05 12:01 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:45 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006