dbTalk Databases Forums  

Re: Calling Procedure with Cursor getting slow after calling the 10th time

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Re: Calling Procedure with Cursor getting slow after calling the 10th time in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ivan T. Bowman [Sybase iAnywhere]
 
Posts: n/a

Default Re: Calling Procedure with Cursor getting slow after calling the 10th time - 11-20-2009 , 03:27 PM






Plan caching may be involved. The optimizer compiles a plan without looking
at the current values of variables, in some cases this can cause a poor plan
to be selected. This special plan is used on the 10th execution of a
statement eligible for caching.

Try setting the option max_plans_cached=0 either globally or within the
procedure. If this changes the behaviour, you can use the "OPTION( FORCE
OPTIMIZATION )" query hint to prevent plan caching for the individual
statement that is causing the problem.

The server uses a policy intended to avoid poor plans being generated by
plan caching but there are some cases that are not detected by this policy.

--
Ivan T. Bowman
SQL Anywhere Research and Development
[Sybase iAnywhere]

<Harrald K. Ott> wrote

Quote:
Hello Everybody,

i have some trouble with a procedure opening a cursor. After
calling the procedure app. the 10th time, fetching the
cursor takes enourmous time, even if the cursor is using the
same select statement as the frist 10 times.
The cursor is defined as NO SCROLL with FOR READ ONLY.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.