Category Archives: Indexing

Index Hints and Distributed Queries

Oren Nakdimon 4 Replies

There are two ways to specify indexes in optimizer hints: by the index name, or by the index’s (leading) columns: The latter is usually preferred, as the writer’s intention is clearer, and it’s immune to changes of the index name. Note: one can present the opposite argument, that specifying the index name is immune to […]

Continue reading

A Single Query with Many Filter Combinations

Oren Nakdimon 10 Replies

Let’s assume the EMPLOYEES table (from the HR schema) contains many records, and we want to write an (efficient) SQL query that filters it by one or more of the following columns: DEPARTMENT_ID, JOB_ID, MANAGER_ID and LAST_NAME. For example: in one execution we may want to get all the employees with DEPARTMENT_ID = 80 in […]

Continue reading

Constraint Optimization Summary

Oren Nakdimon Leave a Reply

This is the last part of a series about Constraint Optimization. In this post I’ll summarize the conclusions from the previous parts. When we add a constraint to an existing table, there are two aspects that are worth taking into consideration: duration and availability. Duration When the table contains a significant number of rows, adding […]

Continue reading

(Lack of) Optimization of Unique Constraint Creation

Oren Nakdimon 1 Reply

The Constraint Optimization series: Part 1: Optimization of Check Constraint Creation Part 2: Optimization that Violates Data Integrity Part 3: Optimization of Foreign Key Constraint Creation Part 4: (Lack of) Optimization of Unique Constraint Creation Part 5: Adding a Column with a Default Value and a Constraint Part 6: Fast but Offline, or Online but […]

Continue reading

A Recipe for Summoning the RBO Monster (even in Oracle 12c): On Delete Cascade, Function-Based Index and Missing Table Statistics

Oren Nakdimon Leave a Reply

The last version of Oracle in which CHOOSE was officially supported as an OPTIMIZER_MODE parameter value was 9.2. This is what the documentation of Oracle 9.2 says about it: choose The optimizer chooses between a cost-based approach and a rule-based approach based on whether statistics are available. If the data dictionary contains statistics for at […]

Continue reading