peripleo2
peripleo2 copied to clipboard
More time histogram optimization: precomputing bounds
There are several ways in which the time histogram can be optimized (cf. issue #104, #26, #28). Another problem, however, is that our materials are starting to cover an enormous timespan.
One particularly severe edge condition is when a query hits results across the whole range - from neolithic to present. At the moment, the histogram is always aggregated to decade and century granularity at the server; and after that, the more suitable time series is returned to the client. Decade aggregation, in this case, will take several seconds.
Even though it might introduce extra delay for "narrow" (in the temporal sense) result sets (which compute fast), we should probably change histogram computation to a two-step process: get the min/max of the interval first, and then build the aggregation once, with the widest possible bucket size.