How to ignore or avoid a projection to be used in Vertica
Recently i came across a nice feature called "AvoidUsingProjections" that can be used in Vertica, it is actually an option that can be used with the set_optimizer_directives Vertica function.
What is the point of using this ?
Well maybe Vertica doesn't choose the best projection for you and you decide to tell Vertica what projection to use(you force the use of a specific projection)
Basic Syntax:
Here is an example of you can use it:
For this example i will use the table dc_proj_used that has 2 projection as seen below:
Now let's do a select on the table dc_proj_used and see what projection is using
we can see that it's using the dc_proj_used_b0 to resolv our query.
Now let's go and tell vertica to stop using this projection:
Run the select with explain to see the projection that is using now
see that is listening to the directives we just set.
What if we tell it to avoid using both of the projections ?
first we need to clear the directive
Tell the optimizer to avoid both projections:
Run the query now
Use this option with care and on your own risk.