Give me this sum and count value of :
SELECT COUNT(*),SUM(Ncat) FROM Sum_Categ_per_periode
I think join is not optimizable, and query need to scan fixed subset of the full cartesian product of two table .
Only possible ( hard ) solution , but it could not be better, is with manual query, with use of data statistics ( like unique values, etc ).
This need partial query, expression index and a scan with internal
computation.
This can improve the speed, but only if the data are much correlate, and
this correlation you cannot explain to the query engine.
If a solution not exist, you need to redesign the structure of tables.
Fabio