dbTalk Databases Forums  

showplan results in esql/c

comp.databases.sybase comp.databases.sybase


Discuss showplan results in esql/c in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
J. Bajdala
 
Posts: n/a

Default showplan results in esql/c - 12-02-2003 , 08:41 AM






Hallo,

we have performance problems with an
esql/c program.

The select via isql works fine and is
fast but takes some minutes in the esql/c
program.

I think it's possible to activate
"set showplan on" via "exec sql".

But how do I get the text of the
execution plan?

Rega


Reply With Quote
  #2  
Old   
Ibrahim DOGAN
 
Posts: n/a

Default Re: showplan results in esql/c - 12-03-2003 , 04:10 PM






Quote:
The select via isql works fine and is
fast but takes some minutes in the esql/c
program.
Make sure you're running *identical* sql in isql and esql/c.
esql/c might be using different datatype in WHERE clause than indexed
column(s) that causes tablescan.

i.d.


Reply With Quote
  #3  
Old   
Mariano Corral
 
Posts: n/a

Default Re: showplan results in esql/c - 12-04-2003 , 01:38 PM



I'm not sure if it's possible to print the "showplan"
as an ESQL program runs. If not, there are other
things you can do, such as running
sp_showplan <spid>, NULL, NULL, NULL
as the program executes. Unfortunately, this only
shows the execution plan for INSERT, UPDATE,
DELETE and plain SELECT, not ESQL cursors, where
sp_showplan only shows the cursor name.

If the ESQL program executes SQL with slower
performance than isql, check the common causes for
this:
- Add "FOR READ ONLY" in every non-updateable cursor.
Otherwise, ASE will asume it is a cursor for update
and choose a unique index, even if there is
a more performant non-unique index
- Check datatype mismatch. IIRC, differences in the
length of char variables are handled OK by ESQL,
but this is not the case with numbers; mismatchs
between int and float, for instance, may prevent
ASE from choosing an index.
- In very rare cases, cursors behave differently
than plain selects. If in doubt, check if isql
shows the same showplan for a SELECT and its
corresponding OPEN cursor.
For instance, cursors cannot use the "OR
strategy" (not the same as the "special OR
strategy", which cursors can use)
- The optimizer uses different statistics if the
value of a column is known or not. If in doubt,
check if isql shows the same showplan for both;
for instance,
WHERE COL1 = 7
versus
WHERE COL1 = @local_variable

Regards,
Mariano Corral

"J. Bajdala" <baj (AT) sisis (DOT) de> wrote:
Quote:
we have performance problems with an
esql/c program.

The select via isql works fine and is
fast but takes some minutes in the esql/c
program.

I think it's possible to activate
"set showplan on" via "exec sql".

But how do I get the text of the
execution plan?

Reply With Quote
  #4  
Old   
J. Bajdala
 
Posts: n/a

Default Re: showplan results in esql/c - 12-11-2003 , 02:33 AM



Mariano Corral wrote:

Quote:
I'm not sure if it's possible to print the "showplan"
as an ESQL program runs. If not, there are other
things you can do, such as running
sp_showplan <spid>, NULL, NULL, NULL
Thanks for the hints.

I checked them (especially the cursor and
variable hint) but the execution plan was
ok.

We then tested our program at a big customer
database - the performance was fine there.

Since this program shall run only once
(at different customers db's of course)
we hope this was a special problem at our
database and hope the best for our customers :-)

Regards

Jürgen



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.