which projection is the primary one
Hi,
I have a three nodes VERTICA
cluster with Ksafe=1. When I create a table with “create table test_proj as select * from all_tables”
I got two projections with name “test_proj_b0” and “test_proj_b1”. I think one is primary projection another is buddy projection, right?
I want to know which one is primary projection which one is buddy projection?
if I run a query against this table, which one will serve the query?
0
Comments
Usually as per the naming conventions in Vertica.
A primary projection in your case is called a super projection and another buddy projection is nothing but the buddy projection for this super projection ( in other words this also refers to a super projections but on a offset node). So b0 is super projection and b1 is buddy projection for its super projections
Lets understand this with your example:
I created a table NAVIN.TEST_PROJ Table created, now lets see what projections it made and its details Above it can be seen that both are super projections and they are segmented across nodes. thats why we con't see any specific node_name.
Now coming to your question, which is primary (super projection) and which is buddy projection.
A simple way to understand this is seeing their ddl:
DDL for test_proj_b0 DDL for test_proj_b1 As we see clearly above, the ddl is different at the end for both projections
b0 has segmentation on all nodes
b1 has segmentation on all nodes offset 1
This means b1 is buddy projection for b0 projection.
For more information on Vertica naming conventions with Projections , you can refer here
How does Vertica name projections
Hope this helps
NC
If I may add some complicating information: There is a projection that Vertica will tend to pick more often. (They're identical and we have to pick one; it just happens that we do so predictably.) But there really is no absolute notion of a "primary" projection in Vertica. The two are buddies of each other; they are interchangeable.
For example, there are cases (often to do with multiple-nodes-down scenarios) where we will actually use pieces of both projections simultaneously, potentially in a somewhat-complicated way, to answer queries. Recent Vertica versions have gained some additional cleverness (and complexity) here.
Also, if you manually create projections, it is possible to have two projections that are buddies but that have different sort orders. We don't typically recommend this because it slows recovery dramatically -- we can't just copy ROS containers from the recovering node's buddy; we have to re-sort the data. But you can do it. In this case, Vertica's optimizer will choose one buddy or the other based on which is optimal for the current query.
The output of EXPLAIN for a particular query should give you more information about which projections that query is using.
Adding to Adam's notes for EXPLAIN plan.
You can even use this table to check which query uses what projection.
PROJECTION_USAGE
Hope this helps
NC