I have situation where i have to select the primary index . I have a huge table almost with 50 columns.
Combination of my integer columns are not so unique but if i add Varchar field it becomes unique. Even only varchar field alone is very unique. But as far as i know , as a good practice we should not select varchar field as PI but dont know the reason.
Could you please let me know can i select the varchar field alone as PI if not then why? Or does not matter column is varchar or integer all does matter is distribution only.
Actually i am planning to use Customer_Name column as PI but this column is not going to use much in the join columns but if i don’t use this column then i am getting skew space error and its not allowing me to insert the records in the table.
Do you think i should use composite PI or just Name field?
I suggest you check the data distribution properly. You have 50 columns. Else you may need to change later.
You can go ahead with composite if you are using them too in access conditions.
While choosing a PI, you always have to balance between the distribution and access. Some columns will give you optimal distribution while some will provide optimal access performance. You need to choose column with good distribution and better access. Good distribution helps parallel processing, so having optimal distribution a lot of access performance will be gained.