On 02/04/2020 08:12, Patrick Marten patrick_mar...@yahoo.com [firebird-support] wrote: > There was an other procedure that took long, and I was able to > drasticaly improve it by adding one multi-segment index, but all my > attempts to do the same in the case above didn't have much impact so far.
Just a quick reply while passing ... CTE https://firebirdsql.org/refdocs/langrefupd21-select.html#langrefupd21-select-cte for example. Use the 'with' section to produce a view of the data that you need to work with, and then the select section can include the 'sum' on the already filtered data. I'm working with tables that are in the millions now but the reports are now as fast as they were when we only had tens of thousands ... I'm summing the current day or week from many years of live data. -- Lester Caine - G8HFL ----------------------------- Contact - https://lsces.uk/wiki/Contact L.S.Caine Electronic Services - https://lsces.uk Model Engineers Digital Workshop - https://medw.uk Rainbow Digital Media - https://rainbowdigitalmedia.uk