Force.com Data Modeling: The Advantages of Denormalization

Post on 22-Nov-2014

221 views 9 download

Tags:

description

Your data model choices impact analytics, performance, security, user experience, and coding requirements. While it might seem counterintuitive, the key to successful Force.com data model design is a pattern of denormalization, with tightly coupled attributes that describe core entities, rather than the traditional pattern of normalization. Join us as we explore the pros and cons of these design patterns.

Transcript of Force.com Data Modeling: The Advantages of Denormalization

Force.com Data ModelingThe Advantages of Denormalization

Michael Topalovich, Delivered Innovation, CTO@topalovich

All about Delivered Innovation

Delivered Innovation helps growing companies run their businesses in the cloud with Salesforce.

Business process design for creating great customer experiences

100% focus on Salesforce and the Salesforce Platform

Founded in 2006 in Chicago by Michael Topalovich

Goals

GAME PLAN

Why Normalize?

Update Anomaly

Insertion Anomaly

Deletion Anomaly

Denormalize for the cloud.

Multitenant Architecture

How many custom objects can you have in

Force.com?

How many custom objects can you have in

Force.com?

200 (Enterprise Edition)2,000 (Unlimited

Edition)

How many custom fields can you have on an

object?

How many custom fields can you have on an

object?

500 (Enterprise Edition)800 (Unlimited Edition)

Metadata-driven architecture =

No direct database access.

Metadata-driven architecture =

Describe for context.

Metadata-driven architecture =

Custom query language.

SQL vs. SOQL

SOQL = Join limitations

SOQL = Explicit relationships

Entities describe somethingthat should exist only once.

Attributes providecontext that describeentities as a whole.

Relationships describehow entities are connected.

What are the two primary types of

relationship fields?

What are the two primary types of

relationship fields?

LookupMaster-Detail

How many levels can you go up in a child-to-

parent relationship query?

How many levels can you go up in a child-to-

parent relationship query?

5 Levels

How many levels can you go down in a parent-to-child

relationship query?

How many levels can you go down in a parent-to-child

relationship query?Only one level.

Analytics

User Experience

Clicks vs. Code

Security

Scalability

Embracehierarchy.

Relationship queries!= SQL joins

SOQL requiresrelationships

between objects

We can go up 5 levelsin a child-to-parentrelationship query

We can go down onelevel in a parent-to-child

relationship query

Reference data fromparent objectswith formulas

Aggregate child data withRollup Summary fields

Use Master-Detailrelationships to enablecross-object workflows

Get better reportand dashboard data

Know your siblings.

Children of the same parentdon’t see each other unless…

If you need siblings to see eachother, define a relationship.

If an explicit relationship isnot an option, be prepared

to write Apex Map<> functions.

IRT

Don’t be afraid to useyour custom fields.

Flatten your data modelto improve performance.

Be smart about it.Don’t let your data modelbecome a mess.

Junction objects enable M:Mrelationships between objects.

Reference data and use it inmultiple places without duplication.

All you need is a custom objectwith two relationship fields.

Avoid data duplication.

Reference before copying.

Beware of picklist sprawl.

Which standard object does not support RT’s as

of Winter ’14?

SolutionsAssets

Price Books

Which standard object does not support RT’s as

of Winter ’14?

SolutionsAssets

Price Books

Which standard object does not support RT’s as

of Winter ’14?

Did we meet our goals today?

Do we understand why Force.com data model design is so important?

Do we understand how Force.com is different from relational databases?

Did we learn something new that we can apply to our own instances?

Calls to Action

Take a look at your current data model.

Experiment.

Apply these principles.

Read more about Force.com data modeling.

Get involved in the Force.com community.

@DIChicago

Michael Topalovich

CTO, Delivered Innovation@topalovich