We have a commercial application that was running pretty well in SQL Anywhere 9.02. We have been upgrading our customers to 11.01 and have found that several (Crystal) reports, queries, and bulk updates are running far slower on the new engine. We discovered that setting max_query_tasks=1 helped considerably (a shame, that) but we still have lots of customer complaints related to performance degradation after upgrading.
I realize that this is a pretty general question, but we are wondering if there are any other db options besides Max_Query_Tasks we should be looking at, or if we should be making some kind of change to the way we structure our queries that would allow us to recover at least the level of performance we enjoyed with 9.02.
Seth Krieger www.sosoft.com
asked 30 Jun '11, 18:13
A followup on this question I posted several weeks ago...
As a couple of folks mentioned, the issue appears to be the optimization_goal option. All of our customer databases, including the empty one that goes out with new product, started with an SA 5.5 database that has been upgraded numerous time over the years, and retained legacy option setting "optimization_goal='First-row'". Changing this setting made a significant difference in performance on the majority of databases that we checked. At first I wasn't too sure, because I would have expected better performance on ALL the db's and I had one that remained quite slow regardless of the setting. Further investigation revealed that at least half the accounts in that db had 10 times as many transactions as is typical amoung our customers. As a result, it made sense that our stored procedure that calculates aging was running much slower as well.
I guess SA 9 was more tolerant of the First-row setting than SA 11, so it was not an issue before.
Thanks to everyone who offered suggestions!
answered 28 Jul '11, 17:39
Check out the Application Profiling Wizard, in particular the Database Tracing component.
If you have trouble understanding how to use the Database Tracing Wizard (some people do, like me, and all my clients), the following article was written to help: Database Tracing In 50 Easy Steps.
Also check out the Index Consultant.
If you want to monitor performance, you might try using the SQL Anywhere Monitor but some folks (like me, and my clients) prefer Foxhound... the SQL Anywhere Monitor doesn't claim to be a "performance monitor" and it isn't.
If you specify the dbsrv11 -zl option or call sa_server_option to turn on 'RememberLastStatement', Foxhound will display your Queries From Hell in the connection pane of the Monitor window... well, it will probably display your queries; see How do I get something to show up in the Last Statement column?
Foxhound also displays database and table-level "curiosities" which might address your question about other database options. The Application Profiling Wizard does some of that too: it "provides recommendations for improving database performance when it is complete".
Verify the setting of the "optimization_goal" database option.
For the vast majority of workloads (particularly for reporting or bulk operations), the recommended configuration is to have the database option set to "All-rows" (default for newer engines) and then selectively override it using either the connection property or the FASTFIRSTROW query hint. Unfortunately, databases created on older engines (I believe it is v9 and older) have this option set to "First-row" by default, which usually causes the engine to choose plans with nested loop joins.
If you find that setting optimization_goal to "All-rows" changes the performance, then you will likely want to re-evaluate your max_query_tasks setting, since both of these options affect plan selection and therefore there may be sizable interplay between them.
answered 05 Jul '11, 14:09
Just one thing we recognized during upgrade:
One disrupting change for us was in version 11, that the optimizer is using only the first 32 chars of varchar fields to estimate the frequency of a value (which influences if an index will be used and which strategy will be used) so for long char fields which have similar beginnings it might be usefull to drop the statistics so that the optimizer instead uses a general assumption instead of the histogram values.
In general my recommendation would be to compare the execution plans of affected queries between the two versions and identify the differences.
answered 01 Jul '11, 02:55