You seem to be familiar with the opinions. Predictions are in many ways similar to the views in the concept; they both cache something, but at different levels. In short, views cache queries, and predictions cache query results.
Views cache query statements . You name the predefined queries and then call them after that. Queries are not viewed when they are created. When you execute queries using views, they will not get any performance improvement, as these are regular queries.
Predictions cache query results . Projection requests are executed when they are created, and the results are saved during storage. When you execute any query that may use the query result, Vertica will use these predictions to answer the query and, therefore, improve query performance. After creating the forecasts, you donβt need to do anything special; Vertica will automatically select the forecasts if this can benefit the request. Predictions can be used for a query because the query uses the columns of a subset of the forecasts, have the same sort order, etc.
Projected views, you can select a subset of the columns in a table, merge with other tables, sort by specific columns. However, different forecasts will occupy their own space in order to save the query result; the more projections are created, the more space they will be consumed. Forecasts will be updated automatically, while the corresponding source tables are updated. The update process runs in the background and can take a lot of time depending on the complexity of the request and the size of the data. Therefore, forecasts are more suitable for many readings, rather than for many records. In terms of usage, forecasts are more suitable for reporting than real-time web dashboards.
In the details of the implementation of the table in Vertica, everything is logical. All data in tables is stored in each associated super projection. A super projection contains all the columns in the table and is automatically created by default. All other projections are obtained from super projections.
Vertica will decide which forecasts will be used for the query, but you can also specify the name of the projections directly to force Vertica to use them:
-- List all projections SELECT projection_name FROM projections; -- Force to use super projection, _super is the suffix of the super projection SELECT * FROM FACT_TABLE_super;
You can use the explanation instruction to see which forecasts are used in the query plan. This will help you improve the performance of your request.