Question

I am trying to understand how Vertica DB works and want to know what is the best way to create the projections that will be used by my queries.

  1. I know I can create by writing the code on the vsql line.
  2. Provide the query that will be used to the Vertica Database Designer so that Vertica will create the proper projections for itself.

I am a bit confused, as I create them by hand (without the DB Designer), but Vertica does not seam to use them.

Here's an example:

  • I have the table AAA (id, name, address) and I am planning to run this query on it:

    select count(name) from AAA;

  • For this I am creating a projection called proj1:

    create projection proj1 as select name from AAA;

  • Now I have my created projection, but when i run the explain form, my select count script shows that the created projection is not used.

Can anyone help me understand the problem here?

Was it helpful?

Solution

A query specific projection (does not contain all columns) may not contain all rows, which will not give an accurate count of the records in a table. To be guaranteed an accurate count of the number of rows in a column/table, a super projection should be used.

There isn't an advantage to that query specific projection vs going against the super projection. Your query only deals with the 'name' column, and the metadata will be able to give that information off of the super projection as quickly as any query specific projection, while ensuring count accuracy.

If you run your query with the projection name instead of table name it will force the use of a specific projection. You can compare execution times this way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top