2012). DB2 UDB documentation further states that
“Although the query optimizer decides whether to use
a relational index to access relational table data, it is
up to you to decide which indexes might improve
performance and to create those indexes” (IBM DB2,
2014).
The optimizer is described as built-in database
software that determines the most efficient way to
execute a SQL statement by considering factors
related to the objects referenced and the conditions
specified in the statement. The Oracle database
optimizer receives the parsed query and generates a
set of potential plans for the SQL statement based on
available access paths and hints. It estimates the cost
of each plan based on statistics in the data dictionary.
Optimizer statistics are created for the purposes of
query optimization and are stored in the data
dictionary. The cost of plans is an estimated value
proportional to the expected resource use needed to
execute the statement with a particular plan. It
compares the costs of plans and chooses the lowest-
cost plan, known as the query plan. As documented,
“To choose an access path, the optimizer first
determines which access paths are available by
examining the conditions in the statement's WHERE
clause and it’s FROM clause. The optimizer then
generates a set of possible execution plans using
available access paths and estimates the cost of each
plan, using the statistics for the index, columns, and
tables accessible to the statement. Finally, the
optimizer chooses the execution plan with the lowest
estimated cost” (Oracle® Database Performance
Tuning Guide, 2014).
In the existing architecture, we note that the
RDBMS optimizer is burdened with all the analysis
and decision-making that goes into finding the most
optimal index access paths for the data being sought
by an SQL query. The popular RDBMS
implementations like Oracle, DB2 UDB and SQL
Server provide limited control to the applications and
developers, by way of SQL constructs, using index
hints or altering session properties that can influence
the optimizer’s access path selection in using specific
indexes built on tables. During its query plan
generation, the optimizer takes into consideration all
indexes created on tables with few exceptions like
cases where in Oracle an index has been made
unusable or invisible. We find that one limitation in
the existing architecture is that during this process,
the optimizer does not consider the already available
contextual metadata in terms of index ownership and
the application’s module/action from which the SQL
originated. The documented reason for this is that
“some schema objects, such as clusters, indexes,
triggers, and database links, do not have associated
object privileges” (Oracle® Database Security Guide,
2014)
This is best illustrated with examples. Let’s say in
Oracle database, a user/schema ‘B’ representing a
specialized application, has read access and index
creation privileges on table ‘T1’ which is owned by
another user/schema ‘A’. Now indexes can be created
on table ‘T1’ and owned by user/schema ‘B’ such as
‘B.T1-IDX1’. Suppose that user/schema ‘A’ has two
other existing indexes on table ‘T1’, namely ‘A.T1-
IDX2’ and ‘A.T1-IDX3’. Now, when a SQL from
user/schema ‘A’ comes to the optimizer that involves
data access from table ‘T1’, the optimizer takes into
consideration all three indexes - ‘A.T1-IDX2’, ‘A.T1-
IDX3’ as well as ‘B.T1-IDX1’. It does not matter that
index ‘B.T-IDX1’ was created by application
designers to only support specific SQLs coming from
user/schema ‘B’ for a specific application’s module
and action. Under this current architecture where
indexes “belong” to a table without any object
privileges of their own, and, therefore, must be
considered and used by the optimizer for all SQLs
referencing the table, we find two performance
related problems as described in the following
sections.
4.1 Higher Hard Parse times
The first problem in the existing architecture where
indexes “belong” to tables and thus all indexes on all
tables referenced in the query must be evaluated by
the optimizer during hard parse, is that this can often
lead to higher hard parse times and locking
contentions, especially when multiple hard parse
requests come in to the database concurrently
accessing the same objects. In most N-Tier modern
business applications, the SQLs are dynamically
generated by middleware SQL-generation engines
based on an abstracted logical data model layer. As a
result of and due to various limitations in the process
of run-time dynamic SQL generation, the number of
tables referenced in SQLs has been getting larger. In
addition, the number of indexes created on each table
has also increased significantly due to the number and
type of applications that need to be supported. For
example, in the latest Oracle Fusion Applications, we
frequently find SQLs referencing 20 to 40 tables, each
with a large number of indexes. The final result is that
the number of indexes for all tables in a SQL that need
to be considered and evaluated by the optimizer has
increased manifold. In addition, the optimizer goes
through more permutations at hard parse time to get
the most optimal execution plan due to many more
ICEIS2015-17thInternationalConferenceonEnterpriseInformationSystems
262