Domain indexes. Quick dive.

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.

Continue reading “Domain indexes. Quick dive.”

Evolution of regular expressions

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.
Continue reading “Evolution of regular expressions”

Yet another approach to overcome bloom filter bug

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.
Continue reading “Yet another approach to overcome bloom filter bug”

Measuring context switches

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.
Continue reading “Measuring context switches”

dbms_comparison

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.

Continue reading “dbms_comparison”

Amending statistics list for autotrace

I wonder why Oracle has not added possibility to change the list of statistics for autotrace but unfortunately that’s a fact.

You cannot change the default format of the statistics report.

However there are at least three different ways to view the extended list of statistics for given session

  1. Use dbms_session.set_identifier and dbms_monitor.client_id_stat_enable/dbms_monitor.client_id_stat_disable.
  2. First drawback is that enabling and disabling of stats collecting must be executed in another session and second drawback is that it collects only 27 statistics.
    Advantage is the ease of monitoring several sessions with the same client_id.

  3. Use queries on v$sesstat, v$statname in another session and find difference between executions.
  4. The disadvantage is the need to run service queries in second session to avoid side affects and positive aspect is that all existed statistics can be reported.
    It’s not necessary to create another session manually though. It’s possible to implicitly execute some statements in another session, for example by using dbms_job/dbms_scheduler.

  5. Use widely known package runstats_pkg by Tom Kyte.
  6. The drawbacks are the same as for previous approach: either you have to run runstats in another session or results are not absolutely precise.

Even though documentation says that we cannot change the default format of the statistics report, it’s in fact possible to amend it.
The only restriction is that number of statistics cannot exceed 11.
Continue reading “Amending statistics list for autotrace”