Saturday 31 October 2020

Skinny tables in Salesforce

Use skinny table if performance is not good enough even after using custom indexes- A skinny table is a custom table in the Force.com platform that contains a subset of fields from a standard or custom base Salesforce object. Force.com can have multiple skinny tables if needed, and maintains them and keeps them completely transparent to you.

What is the Skinny table?

Salesforce can create skinny tables to contain frequently used fields and to avoid joins. This can improve the performance of certain read-only operations. Skinny tables are kept in sync with their source tables when the source tables are modified.

You need to contact Salesforce Customer Support for skinny table. You can’t create, access, or modify skinny tables yourself. This table shows an Account view, a corresponding database table, and a skinny table that would speed up Account queries


How Skinny Tables Can Improve Performance

 What are skinny tables? What makes them fast? For each object table that’s visible to you, Salesforce maintains other, separate tables at the database level for standard and custom fields. This separation, which is invisible to customers, ordinarily requires a join when a query contains both kinds of fields. A skinny table contains both kinds of fields and also omits soft-deleted records

  • They avoid resource intensive joins
  • Their tables are kept in sync with their source tables when source tables are modified
  • They do not include soft deleted records
  • Skinny help improve report and query performance in following ways-:
  • Skinny tables provide a view across multiple objects for easy access to combined data
  • Skinny tables contain frequently used fields and thereby help avoiding joins
  • Skinny tables are kept in sync with changes to data in source tables
  • Skinny tables can contain the following types of fields : 
    • Checkbox
    • Date
    • Date and time
    • Email
    • Number
    • Percent
    • Phone
    • Picklist (multi-select)
    • Text
    • Text area
    • Text area (long)
    • URL

When to Use?

Skinny tables are most useful with tables containing millions of records. They can be created on custom objects, and on Account, Contact, Opportunity, Lead, and Case objects. In addition, they can enhance performance for reports, list views, and SOQL. The skinny table allows you to reorganize selected columns and rows of data into a separate table.

Considerations

  • Skinny tables can contain a maximum of 100 columns.
  • Skinny tables can’t contain fields from other objects.
  • Skinny tables are copied to your Full sandbox orgs.
  • Skinny tables aren’t copied to your sandbox organizations. To have production skinny tables activated for sandbox types other than Full sandboxes, contact Salesforce Customer Support.