Kristian Waagan wrote:
Does the daemon when it determines an update is necessary, go through
the udpate stat path telling it to update stats on all indexes or does
it call update stat one index at a time?
It goes through the path where all indexes are updated.
This can be changed in two locations if we wish to:
1) In the scheduling call (currently it takes a TableDescriptor as an
argument)
2) Inside the daemon itself, where we could (re-)check the status of
each index before processing it.
When a statement is compiled the code checks the index cardinality
statistics for staleness if there are qualifying indexes for the query.
Once a stale index is found for a base table, the table descriptor is
stashed aside to be submitted to the daemon as a unit of work (and we
stop checking the rest of the indexes of that table).
Currently, the only time a unit of work can be scheduled is when a
select statement using an index is compiled/recompiled.
Thanks for quick answer. I think current behavior is fine, just wanted
to understand it. I think it makes sense to update all the stats on
a single table at one time, especially since our staleness metric
is related to table size so likely to apply to all stats on the table.