Eventually it's all about data

The Power of Oracle SQL

Posted by sqlmdx on March 15, 2011

This page contains all versions of my book The Power of Oracle SQL (rus).

Published title Oracle SQL Revealed (eng).



Some changes in compare to Russian version:

Part I

  • First chapter was thoroughly refactored in order to make it easier to read. It has a huge number of examples and they have been structured a bit better.
  • New chapter “Aggregate Functions” (it also includes information about pivoting/unpivoting).
  • Some details about performance and internal implementation were added regarding pattern matching.
  • Chapter “Logical Execution Order of Query Clauses” was completely reworked. In Russian version it contains a few inaccuracies which may lead to wrong conclusions.

Part II

  • Solutions for a few of quizzes have been improved or changed. In particular, for Ordering Dependencies and Resemblance Group.
  • Some new approaches have been introduced, for instance, for Zeckendorf Representation, etc.


Posted in Oracle | Leave a Comment »

Domain indexes. Quick dive.

Posted by sqlmdx on March 15, 2020

Extensible indexing interface

Domain indexes are used to speed up data retrieval for specific domains like text, spatial or image data. Oracle has built in indexes for above mentioned domains but developers can create their own using extensible indexing interface (ODCIIndex).

Let’s consider specific task when this can be useful and discover process end-to-end.

Read the rest of this entry »

Posted in Oracle | Tagged: , , | Leave a Comment »

Evolution of regular expressions

Posted by sqlmdx on July 2, 2016

Frankly speaking “evoulution” is not quite proper word to title this post.
I’m going to show some extensions in regular expressions in different languages in compare to their implementation in Oracle.

Oracle supports regular expressions according to POSIX standard draft 1003.2/D11.2 and two extensions

  • matching capabilities for multilingual data
  • some commonly used PERL regular expression operators (for example, character class shortcuts and the nongreedy modifier “?”)

Let’s consider quizzes which cannot be easily resolved using built-in capabilities in Oracle.
Read the rest of this entry »

Posted in Oracle, Perl, PowerShell | Tagged: | Leave a Comment »

Differentiation of functions in Python and R

Posted by sqlmdx on May 21, 2016

Calculating value of derivative function is a part of many applied tasks such
– gradient descent/ascent for finding minimum/maximum of a function
– Newton’s method for finding approximations to the roots (or zeroes) of a real-valued function

There are three main ways to calculate derivatives
1. Finite differences i.e. calculate approximation using (f(x+Δx)-f(x))/Δx when Δx is close to zero.
2. Symbolic differentiation – generates exact formula for derivative function.
3. Automatic differentiation – generates evaluations (and not formulas) of the derivatives. All intermediate expressions are evaluated as soon as possible.
A brilliant explanation of automatic differentiation may be found here in a paper by Warwick Tucker “One-dimensional, first-order, and Taylor-mode automatic differentiation with programming examples”.

So let’s have a closer look on some technics for derivation in Python/R.
Read the rest of this entry »

Posted in Python, R | Tagged: | Leave a Comment »

Oracle OLAP option. Quick dive.

Posted by sqlmdx on March 26, 2016

There are quite a few tools and ways to build and manage cubes in Oracle so in this post I’ll try to clarify some concepts.
Good top level introduction could be found in article by Arup Nanda – Data Warehousing and OLAP.
Detailed step by step tutorial – Building OLAP Cubes.
The easiest way to start is to explore existing sample schema.
Read the rest of this entry »

Posted in Oracle | Tagged: | Leave a Comment »

Is a row locked?

Posted by sqlmdx on December 22, 2015

Let’s consider “hypothetical” case when it’s required to check if row is blocked without attempting to lock it.
And maybe we’ll find a way to see uncommitted data in Oracle. 🙂
Read the rest of this entry »

Posted in Oracle | Tagged: | Leave a Comment »

fetch first … percent

Posted by sqlmdx on December 19, 2015

New syntax for so called “Top N” queries was introduced in Oracle 12c.

It can be used to return either fixed number of rows or specified percent of rows in a table.
Obviously latter requires to know the total number of rows to return the result so let’s check what is happening under the hood in this case.
Read the rest of this entry »

Posted in Oracle | Tagged: , | Leave a Comment »

Context switches may not be an issue any longer

Posted by sqlmdx on December 13, 2015

I’ve described how to measure context switches some time ago in this post.

Given that with_clause allows to declare PL/SQL functions in 12c it’s interesting to analyze overhead for context switches in this case.
Read the rest of this entry »

Posted in Oracle | Tagged: , | Leave a Comment »

Yet another approach to overcome bloom filter bug

Posted by sqlmdx on October 4, 2014

Bloom filter may help to dramatically reduce amount of data to be read from partitioned table by eliminating unneeded partitions.
Here is a nice introduction into bloom filters.

Unfortunately bloom filter doesn’t work with DML which causes a lot of challenges in 11gR2.
This bug is documented on metalink Bug 13801198 : BLOOM PRUNING/FILTER NOT USED IN DML STATEMENTS however that note doesn’t suggest any workarounds.
Read the rest of this entry »

Posted in Oracle | Tagged: , , | Leave a Comment »

Measuring context switches

Posted by sqlmdx on September 30, 2014

Almost everyone who has some experience with Oracle knows about notorious notion called “context switches” between SQL and PL/SQL engines.
You can find a great explanation of context switches by Tom Kyte here.

Even though it’s quite simple to measure the overhead introduced by context switches, not so many developers know how to calculate exact number of context switches and moreover how to check whether they occurred or not in some cases.
Read the rest of this entry »

Posted in Oracle | Tagged: | 1 Comment »


Posted by sqlmdx on September 27, 2014

dbms_comparison was introduced in 11g as a powerful tool to compare and synchronize table data in different tables.
Even though it’s quite flexible it has some limitations:
1. The tables are supposed to be in different databases. Therefore if you want to compare tables in the same database you will need to create fake db link.
2. The tables must have unique indexes.

Another consequence from the flexibility is that synchronizing is being applied in two steps (merge & delete) even though it could have been done using single merge statement.
Moreover those statements are based not only on tables that are synchronized but also on auxiliary data populated after comparison.
Read the rest of this entry »

Posted in Oracle | Tagged: | Leave a Comment »