Writing and Deploying Custom Projections

Before you write custom projections, review the topics in Planning Your Design carefully. Failure to follow these considerations can result in non-functional projections.

To manually modify or create a projection:

  1. Write a script with CREATE PROJECTION statements to create the desired projections.
  2. Run the script in vsql with the meta-command \i.

    You must have a database loaded with a logical schema.

  3. For a K-safe database, call Vertica meta-function GET_PROJECTIONS on tables of the new projections. Check the output to verify that all projections have enough buddies to be identified as safe.
  4. If you create projections for tables that already contains data, call REFRESH or START_REFRESH to update new projections. Otherwise, these projections are not available for query processing.
  5. Call MAKE_AHM_NOW to set the Ancient History Mark (AHM) to the most recent epoch.
  6. Call DROP PROJECTION on projections that are no longer needed, and would otherwise waste disk space and reduce load speed.

  7. Call ANALYZE_STATISTICS on all database projections:
    => SELECT ANALYZE_STATISTICS ('');

    This function collects and aggregates data samples and storage information from all nodes on which a projection is stored, and then writes statistics into the catalog.