Databases Reference
In-Depth Information
A currency flag doesn't work for assertions, either. Since
asserted version tables support deferred transactions and
deferred assertions, the same passage of time can move a cur-
rently asserted row into the past, and can also move a deferred
assertion into current assertion time. And again, it is nearly
impossible to maintain these flags on the exact clock tick when
the change occurs. So there will be times when Now() does fall
between begin and end dates, while currency flags indicate that
it does not.
But as we will now explain, match predicate flags can be used
in place of or in addition to range predicate dates in an index.
A key insight is this: a currency flag must never classify a current
row as non-current. But if that flag happens to classify a small
number of non-current rows as current, that's not a problem.
The objective for the index is to get us close for the most com-
mon access. The rest of the predicates in the query, or in the
maintenance transaction, will get us all the way there, all the way
to exactly the rows we want.
Using a Currency Flag to Optimize Queries
While many queries will look for versions that are no longer
effective, or perhaps not yet effective, the vast majority of
queries will look for versions that are currently asserted, versions
that represent our best current knowledge of how things used to
be, are, or may be at some point in the future. So it seems that
there is greater potential improvement in query performance if
we focus on assertion time.
We will call our current assertion time flag the circa flag
(circa-asr-flag). It distinguishes between rows which are defi-
nitely known to be in the assertion time past from all other rows.
All asserted version rows are created with an assertion begin date
of Now() or an assertion begin date in the future. They are all
created as either current assertions or deferred assertions. When
they are created, their circa flag is set to 'Y', indicating that we
cannot rule out the possibility that they are current assertions.
One way that a row can find itself in the assertion time past is
for the AVF to withdraw that row in the process of completing a
temporal update or a temporal delete transaction. When it does
this, the AVF will also set that row's circa flag to 'N'. At that point,
both the flag and the row's assertion end date say the same
thing. Both say that the row is definitely not a currently asserted
row. (Both also say that the row is definitely not a deferred asser-
tion, either; but the purpose of the flag is to narrow down the
search for current assertions.)
Search WWH ::




Custom Search