Partition Pruning and Global Indexes
There is a common misconception that partition pruning does not help in the case of global indexes and only works with local indexes or full table scans (FTS). It is understandable how this...
View ArticleInterval Search: Part 4. Dynamic Range Segmentation – interval quantization
Forums, mailing lists, and StackOverflow are all great resources for Oracle performance discussions, but I’ve long thought it would be useful to have a dedicated online chat/group specifically for...
View ArticleInterval Search: Part 3. Dynamic Range Segmentation – Custom Domain Index
In this part, I’ll show how to implement Dynamic Range Segmentation (DRS) explained in the previous part using a custom Domain Index, allowing you to apply this optimization with minimal changes to...
View ArticleInterval Search: Part 2. Dynamic Range Segmentation – Simplified
In the previous part, I discussed the most efficient known methods for optimizing range queries. In this part, I’ll introduce a simple version of my custom approach, which I call Dynamic Range...
View ArticleInterval Search: Optimizing Date Range Queries – Part 1
One of the most common and enduring challenges in database management is performing efficient interval searches, particularly for date intervals such as: WHERE :dt BETWEEN beg_date AND end_date. In...
View ArticleCBO and Partial indexing
Oracle 12c introduced Partial indexing, which works well for simple partitioned tables with literals. However, it has several significant issues: For instance, consider the following simple...
View ArticleSlow index access “COL=:N” where :N is NULL
All Oracle specialists know that a predicate X=NULL can never be true and we should use “X is NULL” in such cases. The Oracle optimizer knows about that, so if we create a table like this: create...
View ArticleWorkarounds for JPPD with view and table(kokbf$), xmltable or json_table...
You may know that table() (kokbf$ collection functions), xmltable and json_table functions block Join-Predicate PushDown(JPPD). Simple example: DDL create table xtest(a, b, c) as select...
View Articlev$sql_hint.target_level
Today I wanted to give a link to the description of v$sql_hint.target_level to show that no_parallel can be specified for statement or object, and though it’s pretty obvious, but surprisingly I haven’t...
View ArticleTop time-consuming predicates from ASH
Sometimes it might be useful to analyze top time-consuming filter and access predicates from ASH, especially in cases when db load is spread evenly enough by different queries and top segments do not...
View ArticleCorrect syntax for the table_stats hint
A friend contacted me to ask why they were having problems using the table_stats hint to influence optimizer decision making and also to influence the decision to use direct read or buffer cache scan...
View ArticleLateral view decorrelation(VW_DCL) causes wrong results with rownum
Everyone knows that rownum in inline views blocks many query transformations, for example pushing/pulling predicates, scalar subquery unnesting, etc, and many people use it for such purposes as a...
View ArticleWhy are HCC stats being bumped when Smart Scanning row major data in 12.2
In 12.2, there is a stat “cell blocks pivoted” that points to a new optimization. When Smart Scan processes data, it has to create a new synthetic block that only contains the columns that are needed...
View ArticleTop-N again: fetch first N rows only vs rownum
Three interesting myths about rowlimiting clause vs rownum have recently been posted on our Russian forum: TopN query with rownum<=N is always faster than "fetch first N rows only" (ie....
View ArticleHow to group connected elements (or pairs)
I see quite often when developers ask questions about connected components: Table “MESSAGES” contains fields “SENDER” and “RECIPIENT”, which store clients id. How to quickly get all groups of clients...
View ArticleHow to speed up slow unicode migration of a table with xmltype columns
Recently I have had an issue with slow unicode migration of the database upgraded from 10g to 12.1.0.2. The main problem was a table with xmltype: we spent about 4 hours for this table(~17GB) during...
View ArticleWINDOW NOSORT STOPKEY + RANK()
Recently I found that WINDOW NOSORT STOPKEY with RANK()OVER() works very inefficiently: http://www.freelists.org/post/oracle-l/RANKWINDOW-NOSORT-STOPKEY-stopkey-doesnt-work The root cause of this...
View ArticlePRECOMPUTE_SUBQUERY hint
I’ve just found out that we can specify query block for PRECOMPUTE_SUBQUERY: /*+ precompute_subquery(@sel$2) */ So we can use it now with SQL profiles, SPM baselines and patches. SQL> select/*+...
View ArticleStrange moving filter predicates from index to table
It seems strange to me: When all needed columns are in the index, filter predicates are expectedly applied to the index select a,b from xt_test where a=1 and (:b is null or b = :b)...
View ArticleUnresolved quiz: Avoiding in-list iterator
A couple days ago i had very interesting quiz, which is not resolved yet. Look at this simplified query: select * from xt1,xt2 where xt1.b=10 and xt1.a=xt2.a and xt2.b in (1,2); PLAN_TABLE_OUTPUT...
View Article