开发者

Performance issues in Sybase 12.5 to Sybase 15 migration

We are in the process of migrating our DB to Sybase 15. The stored procedures which were working fine in Sybase 12.5 have a poor performance in Sybase 15. However when we add 'set merge_join of开发者_C百科f' Syabse 15 performs faster. Is there any way to use the sybase 12.5 stored procs as it is in Sybase 15 / or with minimal changes? Do we have any alternate ways apart from rewriting the whole stored proc?


I think this depends on how much time and energy you have to investigate Sybase 15 and use its new optimisers.

If this is a small app and you just want it working without clueing up on some or all of the new optimisers, index statistics, datachange, login triggers, then use either compatibility mode or maybe better, restrict the Optimiser to be allrows_oltp, avoiding dss and mix (which would use hash joins and merge joins respectively.)

If it's a big system and you have time, I think you should find out about the above, allow at least mix if not dss too, and make sure you

have index statistics up to date (much more important to have stats on 2nd and subsequent cols of indexes to opimise right for merge and hash joins.) understand DATACHANGE (to find tables that need stats updates.) login triggers (can be v useful to configure some sessions/users down or up optimisation levels - see sypron website for Rob Verschoor's write-up.) make sure you've got access to sp_showplan (use a tool, or get sa_role, or use Rob Verschoor's CIS technique to grant.)

The new optimisers are good, but I think it's true to say that they take time and energy to understand and make work. If you don't have time and energy and don't need the extra performance, just stick to allrows_oltp, or even compatibility mode (I don't have experience of the latter, but somehow it seems wrong to me.)


There is compatibility mode in sybase 15.

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00967.1550/html/MigrationGuide/CBHJACAF.htm


I would say try to find root cause of issue, We too had a issue with one of our procs where timing went up from 27 mins to 40 mins. When diagnosed and fixed proc just took 6 mis to complete (which was 27 mins). ASE15 optimizer and query processing is much better then 12.5.

If you dont have time just set the compatibility mode at session level for this proc.

"set compatibility_mode on"

But do compare the results.

Additionally if you have time do try using DBCC (302,310) and 3604 (for redirection) to understand why optimizer is using such LAVA operator.

Excellent Article by Rob V


Sybase 15 optimizer uses more algorithm of joins i.e Merge Join, Hash join, nested loop join, etc

Where as in Sybase 12.5, the most used algorithm for join is Nested loop join. Apart from switching the compatibility mode on (This will use Sybase 12.5 optimizer and wont give you any benefits of Sybase 15 optimizer), you can play with various optimization goals.

In your case I suggest you set the optimization goal to "allrows_oltp", which will only use nested loop joins in your queries, at server level.

-- server-wide default:
sp_configure 'optimization goal', 0, 'allrows_oltp'

-- session-level setting (overrides server-wide setting):
set plan optgoal allrows_oltp

-- query-level setting (overrides server-wide and session-level settings):
select * from T1, T2 where T1.a = T2.b plan '(use optgoal allrows_oltp)'

allrows_oltp resembles Sybase 12.5 way very closely, and should be tried first before trying any other optimization goals.

Note: After setting to allrows_oltp, do proper testing to see if any other query got affected by this

More info about optimization goals can be found here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜