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 Series: Simplified, Advanced, and Custom Solutions
Interval Search: Part 1. Optimizing Date Range Queries Interval Search: Part 2. Dynamic Range Segmentation – Simplified Interval Search: Part 3. Dynamic Range Segmentation – Custom Domain Index...
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 and sometimes it works fine for simple partitioned tables with literals, but it has a few serious problems: For example, consider the following simple...
View ArticleSlow index access and COL=:N where :N is NULL
All Oracle specialists know that any predicate X=NULL can’t be true and we should use “X is NULL” in such cases. Oracle optimizer knows about that, so if we create a table like this: create table...
View ArticleSimple function returning Parallel slave info
You can add also any information from v$rtsm_sql_plan_monitor if needed create or replace function px_session_info return varchar2 parallel_enable as vSID int; res varchar2(30); begin...
View ArticlePL/SQL functions and statement level consistency
You may know that whenever you call PL/SQL functions from within SQL query, each query in the function is consistent to the SCN of its start and not to the SCN of parent query. Simple example: create...
View ArticleSQL: Fast ways to count unique characters in the string
Test data: create table t_str as select round(dbms_random.value(1e10,9e10)) str from dual connect by level<=1e5 / PL/SQL variant: with function ff(s varchar2) return varchar2 as type avarchars is...
View Articleflashback_transaction_query: fixed table full table scan
Recently I got a question: why CBO chooses “FIXED TABLE FULL TABLE” scan instead of “FIXED INDEX” in case of a join to flashback_transaction_query view with the predicate “q.xid = a.versions_xid”:...
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 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 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 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 Article“Collection iterator pickler fetch”: pipelined vs simple table functions
Alex R recently discovered interesting thing: in SQL pipelined functions work much faster than simple non-pipelined table functions, so if you already have simple non-pipelined table function and want...
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 Article