Coalescing Without Duplicates
This section presents actual Oracle source lines which combine
records with adjacent and/or overlapping periods into single
periods covering the entire duration for which the
adjacent/overlapping periods were valid. The following techniques
are presented :
- Iterative SQL - Uses SQL statements in a loop. Not
as efficient as the cursor-based but competes when
indexed.
- Pure SQL - Uses *ONLY* SQL Statements. From
performance measures taken on larger tables, seems to be
slower than iterative or cursor-based strategies. Being
in pure SQL, this approach is the most portable.
- CursorBased - Uses cursors to go through every
record, comparing period boundaries. Garnered the best
results from the performance experiments made. Problem
with this approach, though, is that it is not SQL at all
and relies on a programming language extension for SQL
from Oracle (PLSQL).
Note : All Source files, include code to
populate sample tables which would be coalesced. The result
files, contains the results of the experiment.
/jag