I recently inherited Denodo admin duties and am investigating a scheduled job which is failing. The job gathers a list of all base tables in Denodo, then runs the following VQL:
```
CALL GENERATE_SMART_STATS_FOR_FIELDS('SMART_THEN_ATSOURCE_THROUGH_VDP','BaseTableName', NULL, true);
```
Where "BaseTableName" is the name of a base table passed to the VQL.
I have read the page on [GENERATE_SMART_STATS_FOR_FIELDS](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/stored_procedures/predefined_stored_procedures/generate_smart_stats_for_fields), and understand that its intent is to gather and store the statistics of fields in base views. What I don't understand is, what's the purpose of that? How is it beneficial, and what can said statistics be used for?
And now for part two...figuring out why it's failing. Some of the views return one or more of the following errors:
> ERROR: View without search methods
> java.sql.SQLException: View without search methods;
> Error while executing the query". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
>
> Error: Executing the query "CALL GENERATE_SMART_STATS..." failed with the following error: "ERROR: Error gathering the statistics of the view: Wrong stats query resultset
> java.sql.SQLException: Error gathering the statistics of the view: Wrong stats query resultset;
>
> Error: Executing the query "connect database eicore; CALL GENERATE_SMART_STATS..." failed with the following error: "ERROR: Error: new Time out processing data
> Error in some access (results of query could not be completed).
I have experienced the "view without search methods" error before, but never on base tables.
On the "Wrong stats query resultset" error, I found another answer which suggested this is due to [limitations of the statistics gathering process.](https://community.denodo.com/docs/html/browse/6.0/vdp/administration/optimizing_queries/cost-based_optimization/gathering_the_statistics_of_views#limitations-of-the-gathering-statistics-process). However, the table in question is a SQL Server table which does not contain TEXT, NTEXT, UNIQUEIDENTIFIER, or SQLVARIANT fields.
As for the time out error, can we increase the time limit? That table is very large and does take an unusual amount of time to query.