Materilized view quite slower than table and lots of time on "Optimizing query & pruning files"

Roxio
New Contributor II

I have a query that calls different materialized views, anyway most of the time of the query is spent in "Optimizing query & pruning files" vs the execution.

The difference is like 2-3 secs for the optimization and 300-400ms for the execution

Similar if I run a query against tables, with the same data structure and data, but in the case of tables the difference is 700-800ms for optimization and 70-80ms for the execution

These are results when data is returned by the cache.

My question is:

- Why such a big difference between materialized views and table, when in theory it should be much similar results

- Is there a way that I can try to reduce the time used for "Optimizing query & pruning files"?