various speed improvements to the collectionHQ extract
This is the result of a first pass to remove inefficient
queries on metabib.real_full_rec and auditor.asset_copy_history.
Most of the changes don't affect the output, but there are a
couple exceptions:
- the new version is more likely to pick the first 082$a
for the class number (which is also more correct)
- the script now bases the "current use count" on the date that
the item was last transited to the current circ lib, rather than
the date the circ lib simply changed.
The last change is the most uncertain. One the one hand, it helps
proof the extract against pruning of the asset.copy auditor table.
On the other hand, if items change their circ library without getting
formally transited (which might be theoretically possible for
some workflows) the current use count *might* be calculated
differently than expected.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>