What is Data Skew in Salesforce? | Interview Question #salesforce #interviewquestions #shorts

preview_player
Показать описание
Data Skew generally refers to a condition where data is distributed unevenly in a large data set. Data skew happens when more than 10,000 child records are associated with the same parent record within an org.

Account Data Skew:

Certain Salesforce objects, such as accounts and opportunities, have unique data relationships that allow parent and child record access to be maintained in private sharing models. In one of these relationships, having too many child records associated with the same parent object causes account data skew. Say you have a bunch of unassigned contacts and park them under one account named “Unassigned.” This can create issues with record locking and sharing performance.

a. Record Locking:
You’re updating a large number of contacts under the same account in multiple threads. For each update, the system locks both the contact being changed and its parent account to maintain integrity in the database. Even though each lock is held for a very short time, because all the updates are trying to lock the same account, there’s a high risk an update will fail because a previous one is still holding the lock on the account.

b. Sharing Issues: When it comes to sharing, the dynamic is similar. When you do something seemingly simple, such as changing the owner of an account, you may need to examine all of the account’s child records and adjust their sharing as well, depending on how you have sharing configured. It may be necessary to recalculate the role hierarchy and sharing rules. And when dealing with hundreds of thousands of child records, that can take a long time.

Ownership Skew: When a large number of records with the same object type are owned by a single user, this imbalance causes ownership skew.

Lookup Skew: Lookup skew happens when a very large number of records are associated with a single record in the lookup object (the object you’re searching against).

Рекомендации по теме