niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Sybase
Parallel first time calls to stored proc
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Anthony Mandic
*nix forums Guru Wannabe


Joined: 05 Jul 2005
Posts: 164

PostPosted: Sun Apr 03, 2005 5:43 am    Post subject: Re: Parallel first time calls to stored proc Reply with quote

CJ wrote:
Quote:

I am having a problem with a stored proc which is dropping out of the
procedure cache and thus being re-resolved the first time it is called
after it has dropped out.

It sounds like your proc cache is too small.

Quote:
The problem is that the first time the
stored proc is called, it can be called N times in parallel (ie
through N different sessions). This will cause N copies of the query
plan to be generated and stored in the cache.

This is what normally happens. Sprocs are non-reenterant,
so every caller gets their own copy. The dbcc memusage
call reports how many instances of the query plan are
in cache.

Quote:
I can accept this as it is the way Sybase works, however what is
surprising is that the time for each stored proc to complete is of
O(N). i.e. if it takes 10 seconds for just one call, then it will
take 100 seconds when there are 10 parallel calls. The stored proc is
a read-only proc, so there are no exclusive locks taken out by it.

Its irrelevant whether it locks or not, each reresolution requires
the optimiser to reresolve the sproc. This can lead to problems
if the query plan generated by the sproc contains conditionals
and the next caller inherits a plan that is not optimal for
their particular query. This is a known problem.

Quote:
Has anyone else come across this problem and found a solution?

Does your sproc have conditional statelemts in it? How big
is it? Can you break it up?

-am © 2005
Back to top
CJ
*nix forums beginner


Joined: 01 Apr 2005
Posts: 1

PostPosted: Fri Apr 01, 2005 10:28 am    Post subject: Parallel first time calls to stored proc Reply with quote

I am having a problem with a stored proc which is dropping out of the
procedure cache and thus being re-resolved the first time it is called
after it has dropped out. The problem is that the first time the
stored proc is called, it can be called N times in parallel (ie
through N different sessions). This will cause N copies of the query
plan to be generated and stored in the cache.

I can accept this as it is the way Sybase works, however what is
surprising is that the time for each stored proc to complete is of
O(N). i.e. if it takes 10 seconds for just one call, then it will
take 100 seconds when there are 10 parallel calls. The stored proc is
a read-only proc, so there are no exclusive locks taken out by it.

Has anyone else come across this problem and found a solution?

CJ
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 4:30 am | All times are GMT
navigation Forum index » Databases » Sybase
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts postfix smtp authentication using mysql stored user/pass rtresidd Postfix 0 Fri Oct 03, 2008 5:58 am
No new posts Running php file everyday on scheduled time sachin PHP 1 Fri Jul 21, 2006 12:49 pm
No new posts Bug#379104: ITP: complearn-mpi -- parallel quartet tree s... Rudi Cilibrasi devel 0 Fri Jul 21, 2006 11:30 am
No new posts How do I render JPEG Data stored in char* buffer? On the Sparrow C++ 2 Thu Jul 20, 2006 8:44 pm
No new posts calling stored procedure using ECPG Jasbinder Bali PostgreSQL 1 Thu Jul 20, 2006 7:53 pm

Car Credit | Debt Consolidation | Xecuter 3 Mod Chip | Guitar Lesson | Internet Advertising
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1213s ][ Queries: 20 (0.0499s) ][ GZIP on - Debug on ]