Subject Re: [IB-Architect] Index Sync/Rebuild Question
Author Charlie Caro
Ann Harrison wrote:
> >Paul Reeves wrote:
> >
> >It seems to me that if rdb$statistics is important then it should be
> >maintained,
> >especially under super server. What else are background, low priority threads
> >for?

Having low priority threads dedicated to this task would be a bit too
specialized. It would also have the potential of zapping performance
when you least expected or desired it.

That said, having this be an adjunct responsibility of the sweep thread
makes some sense. After the sweep thread finishes, most record back
versions, including their index keys, have been removed from the
database. Recomputing index selectivity at this moment is probably as
good as it gets.

> Ann replied:
> As long as it doesn't wipe out the cache.

Though it's not a user-visible feature, improved cache preservation was
a priority goal in the development of InterBase V6. The idea was to
maintain client working sets (active database pages) and important pages
(pointer pages/index pages) in the face of bulk operations which descend
on the server like a tidal wave. These operations include:

- Index scans to recompute index selectivity (SET STATISTICS - thanks
- Dropping large objects (tables, indexes and blobs);
- Large blob retrieval scans;
- Large sequential table scans;
- Database shadow creation;
- Database backups;
- Database sweeps;

These operations will leave resident pages alone in their wake while
queueing pages they read from disk to the LRU tail of the database cache
for immediate reuse (probably by the operation itself.)

Pardon the off-topic seque but Ann opened the door, and I recall that a
customer recently raised this topic in another thread.