We are seing some strange behavior in the way Oracle is handling statistics of an imported schema.
We build a schema on the dev system, analyze if and import into the production with the stats.
For the most part everything works fine, but some query seems to select different plans than in dev. After re-analyzing them in production, the plan becomes the same as on dev. The schema is not changed on prod (pretty much read-only). So there must be some kind of difference between how Oracle handles stats built locally vs imported?
|
|
|||||
|
|
A number of factors can change on import.
Try generating cost statistics for the queries you are using on both the Development and Production systems. You may also want to examine the Statistics on both systems. You may get more consistent results using transportable tablespaces for the tables and indexes. This will eliminate the import/export step. EDIT: Added bitmap, statistics, and histogram info above. It is possible to just run an explain plan without running the queries. There are various tools which assist in this. I have used Aqua Data Studio, but SQL Developer should work as well. For parsed queries (running or not) there is a view available from which the plan can be extracted. There are available views which can be used to view the current statistics for a table. Comparing used blocks on both systems will give you a quick idea how much statistics should have changed. Histogram data is can result in different plans. |
|||||
|