In Part 1 of this series of tips on SQL Plan Management (SPM) and Oracle Database In-Memory, I covered what would happen if we have a SQL plan baseline for a full table scan query when the table was populating the In-Memory column store.
In this part I’m going to cover a scenario where a query has more than one SQL plan baseline:
- There is a query (called Q2, for short).
- Q2 queries a table called MYSALES, which is not yet populating the In-Memory column store.
- Q2 filters rows in MYSALES using a predicate on the SALE_TYPE column.
- Data in SALE_TYPE is skewed, so there’s an index and a histogram on this column.
- Because there is data skew, Q2 has two accepted SQL plan baselines; one with a full table scan and one with an index range scan.
You’ve probably come across this situation many times: the Oracle Optimizer must choose between a full table scan or an index range scan depending on predicate selectivity. The ability to change the execution plan based on the value of bind variables is called adaptive cursor sharing. If you’ve not come across that, then you’ll find it useful to check out the section on this topic in the Database SQL Tuning Guide.
What’s great about SPM is that it allows you to have multiple SQL plan baselines for individual queries, so you're not forced to pick one plan in preference to another. This capability is most relevant in environments where SQL statements use bind variables and there is a good deal of data skew. Queries like this are likely to have their plans affected by Oracle In-Memory Database because in-memory full table scans will have a lower cost than storage-resident table scans. Clearly, the In-Memory column store will affect the point of inflection where a full table scan will become more efficient than an index range scan. How is this going to work with SPM?
Continuar aqui
No hay comentarios:
Publicar un comentario