Your SQL statement:
(SELECT COUNT(COD_TIP_IMG) as fotos, COD_RED, COD_AGE, COD_PRM
FROM ICDBA.IC_FICH_GRAFICOS
GROUP BY COD_AGE, COD_RED, COD_PRM) C

Pando, Create a composite index on COD_AGE, COD_RED,COD_PRM columns, because if the index is available and the columns are mentioned in the Group By clause, the index will be used even though they are not mentioned in the WHERE clause.

With few hundred rows, it is very difficult to predict the performance. Populate 100,000 rows in all tables using LOAD RUNNER, and then do the tuning.