the need for speed: building reports that fly

96
Building Reports That Fly Sean Regan, salesforce.com, @SFDCSRegan John Tan, salesforce.com, @johntansfdc Irena Miziolek, NTT Centerstance Jeannette Liu-Deza, NTT Centerstance

Upload: salesforce-developers

Post on 22-Nov-2014

219 views

Category:

Technology


0 download

DESCRIPTION

In Salesforce, the foundation of reporting is the retrieval of an organization's data. If your data is not retrieved efficiently, your reports can be incredibly slow and might time out, which will frustrate your users. Join us to learn the techniques every expert architect should know in order to build reports that fly--and to ensure that your data is at your users fingertips. We'll spend the vast majority of our time covering specific performance-related techniques, such as using reporting governance, as well as what you need to know about the Force.com query optimizer to write reports that are both fast and selective. Note that this session assumes you already understand the basic principles behind building queries and reports.

TRANSCRIPT

Page 1: The Need for Speed: Building Reports That Fly

Building Reports That Fly

Sean Regan, salesforce.com, @SFDCSReganJohn Tan, salesforce.com, @johntansfdcIrena Miziolek, NTT CenterstanceJeannette Liu-Deza, NTT Centerstance

Page 2: The Need for Speed: Building Reports That Fly

Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Page 3: The Need for Speed: Building Reports That Fly

Your company uses Salesforce/Force.com …

Page 4: The Need for Speed: Building Reports That Fly

You are a developer or architect maintaining your org …

Page 5: The Need for Speed: Building Reports That Fly

Slow reports return unreliable data that hurts user productivity

and leads to mistakes …

Page 6: The Need for Speed: Building Reports That Fly

You need to make these reports faster and trusted …

Page 7: The Need for Speed: Building Reports That Fly

Agenda - Building reports that fly!

1. Governance• Configuration Access• Sharing Access• Data Architecture

2. Frequency• Dashboard & Report Refreshes

3. Efficient Reports• Tuning Reports• Data Archiving/Aggregation

4. Customer Case Study

Page 8: The Need for Speed: Building Reports That Fly

Sean ReganArchitect Evangelist@SFDCSregan

Page 9: The Need for Speed: Building Reports That Fly

John C. TanArchitect Evangelist@johntansfdc

Page 10: The Need for Speed: Building Reports That Fly

View Our Content On Developerforce

http://developer.force.com/architect

Page 11: The Need for Speed: Building Reports That Fly

Irena Miziolek & Jeannette Liu-DezaTechnical & Solution ArchitectsNTT Centerstance

Page 12: The Need for Speed: Building Reports That Fly

How Many Of You Have …?Run a Salesforce report … and waited forever?

Page 13: The Need for Speed: Building Reports That Fly

1. Governance

Page 14: The Need for Speed: Building Reports That Fly

Configuration access

Governance

Page 15: The Need for Speed: Building Reports That Fly

Even Pilots Need Help

Page 16: The Need for Speed: Building Reports That Fly

Restrict Report And List View Creation

Page 17: The Need for Speed: Building Reports That Fly

Report & list view governance helps you …• Increase user adoption• Increase employee productivity• Decrease employee mistakes• Save money

Page 18: The Need for Speed: Building Reports That Fly

Sharing Access

Governance

Page 19: The Need for Speed: Building Reports That Fly

Architect Sharing Based On Business Requirements

Page 20: The Need for Speed: Building Reports That Fly

Global Organization Sharing

Page 21: The Need for Speed: Building Reports That Fly

What’s the impact of sharing access?

Page 22: The Need for Speed: Building Reports That Fly

Data Architecture

Governance

Page 23: The Need for Speed: Building Reports That Fly

Is the correct end result really enough?

Page 24: The Need for Speed: Building Reports That Fly

Understand Your Schema

Page 25: The Need for Speed: Building Reports That Fly

When It Isn’t Necessary, Get Rid Of it.

Page 26: The Need for Speed: Building Reports That Fly

Architect Your Data Model For Performance

VS.

Page 27: The Need for Speed: Building Reports That Fly

2. Frequency

Page 28: The Need for Speed: Building Reports That Fly

Dashboard/Report Refreshes

Frequency

Page 29: The Need for Speed: Building Reports That Fly

More Is Not Always Better

Page 30: The Need for Speed: Building Reports That Fly

Push Data To Users: Force.com Streaming API

Scheduled Reports

Visualforce Pages

Workflow Email Alerts

Chatter Feeds

Page 31: The Need for Speed: Building Reports That Fly

Key Takeaways✓ Governance ensures efficiency & accuracy✓ Know your object model✓ Push data to users to drive workflow✓ Architect your sharing model based on business requirements

Page 32: The Need for Speed: Building Reports That Fly

3. Efficient reports

Page 33: The Need for Speed: Building Reports That Fly

Efficient reports

• Tuning reports• Data archiving/aggregation

Page 34: The Need for Speed: Building Reports That Fly

Tuning reports

Efficient reports

Page 35: The Need for Speed: Building Reports That Fly

What is the Force.com query optimizer?Generates the most efficient query based on:▪ Statistics▪ Indexes / Skinny Tables▪ Sharing

Page 36: The Need for Speed: Building Reports That Fly

Best Practice: One+ Selective Filter Per report

Page 37: The Need for Speed: Building Reports That Fly

Selective Filters: Four Components1. Filters - add filters to reduce data2. Operators - avoid 2 inefficient filter operators3. Thresholds – ensure filter meets selectivity threshold4. Index Creation - index the filter field

Page 38: The Need for Speed: Building Reports That Fly

Filters Reduce The Scope Of Reports

Page 39: The Need for Speed: Building Reports That Fly

Fields That Often Make Good Filters▪ Date fields▪ Picklists▪ Fields with wide and even distribution of values

Page 41: The Need for Speed: Building Reports That Fly

Use Selective Operators In Filters

Page 42: The Need for Speed: Building Reports That Fly

Avoid Negative OperatorsQuery for reciprocal values instead

✖ NOT EQUALS (“closed”)✔ EQUALS (“open”, “in progress”)

Page 43: The Need for Speed: Building Reports That Fly

Avoid Filters With A Leading % WildcardCONTAINS ‘%searchstring%’

✖ CONTAINS (“district”) – equivalent to LIKE ‘%district%’✔ STARTS WITH (“district”) – equivalent to LIKE ‘district%’

Page 44: The Need for Speed: Building Reports That Fly

Ensure Filters Meet Selectivity Thresholds

Page 45: The Need for Speed: Building Reports That Fly

Standard Index Selectivity ThresholdA standard index is selective when it returns:▪ < 30% of the first 1 million records▪ < 15% of returned records after the first 1 million records▪ No more than 1 million total records

Page 46: The Need for Speed: Building Reports That Fly

Standard Index Selectivity ThresholdSelectivity threshold for Created Date index

Page 47: The Need for Speed: Building Reports That Fly

Standard Index Selectivity ThresholdFor 750,000 Account records▪ < 30% of the first 1 million records▪ 750,000 x .30 = 225,000

Page 48: The Need for Speed: Building Reports That Fly

Standard Index Selectivity ThresholdFor 3,500,000 Account records▪ < 30% of the first 1 million records▪ < 15% of returned records after the first 1 million records

▪ (1,000,000 x .30) + (2,500,000 x .15) = 675,000

Page 49: The Need for Speed: Building Reports That Fly

Standard Index Selectivity ThresholdOver 5,600,000 Account records▪ No more than 1 million records▪ 1,000,000

Page 50: The Need for Speed: Building Reports That Fly

Custom Index Selectivity ThresholdA custom index is selective when it returns:▪ < 10% of the first million records▪ < 5% of returned records after the first million records▪ No more than 333,333 records

Page 51: The Need for Speed: Building Reports That Fly

Create Indexes Selective Filter Fields

Trusted traveler program

Page 52: The Need for Speed: Building Reports That Fly

Standard Fields With Indexes▪ Id▪ Name▪ OwnerId▪ CreatedDate▪ SystemModstamp▪ RecordType

▪ Master-detail fields▪ Lookup fields

Page 53: The Need for Speed: Building Reports That Fly

Custom Indexes• Discover common filter conditions• Determine selective fields in those conditions• Request custom indexes

Page 54: The Need for Speed: Building Reports That Fly

A filter condition is selective when …

… it uses an optimizable operator… it meets the selectivity threshold… selective fields have indexes

Page 55: The Need for Speed: Building Reports That Fly

Skinny Tables: Last Resort For Non-optimizable Reports

Page 56: The Need for Speed: Building Reports That Fly

Skinny Table▪ Single Object. No cross-object joins▪ Maximum of 100 fields▪ Not aggregate/summary data. 1:1 recount between source

and skinny▪ Skinny updated automatically▪ Minimal joins▪ salesforce.com will analyze and create

Page 58: The Need for Speed: Building Reports That Fly

Data Archiving/Aggregation

Efficient reports

Page 59: The Need for Speed: Building Reports That Fly

Data ArchivingReduce the # of records the query optimizer needs to consider▪ Determine strategy during design phase▪ Move older records into a different object▪ Soft deletes still count towards record count

Page 60: The Need for Speed: Building Reports That Fly

Data Aggregation▪ Report on historical data▪ Save tabular or summary report to a custom object▪ Use Analytic Snapshots or Batch Apex▪ Gists:

• Batch Apex Class - https://gist.github.com/johntansfdc/7044473• Trigger - https://gist.github.com/johntansfdc/7044570

Page 61: The Need for Speed: Building Reports That Fly

Key Takeaways✓ Reports should contain at least one selective filter✓ A filter is selective if…

✓ the field is indexed ✓ the filter does not use an inefficient operator ✓ the filter meets the selectivity theshold

✓ Implement data archiving/aggregation strategies

Page 62: The Need for Speed: Building Reports That Fly

Introducing customer case

Page 63: The Need for Speed: Building Reports That Fly

Irena Miziolek & Jeannette Liu-DezaTechnical & Solution ArchitectsNTT Centerstance

Page 64: The Need for Speed: Building Reports That Fly

AgendaWhat’s the problem

How to troubleshoot

What’s the solution

Page 65: The Need for Speed: Building Reports That Fly

Client

Page 66: The Need for Speed: Building Reports That Fly

ChallengeReports & dashboards timing out

Errors in Data Loads

Information Overload

Page 67: The Need for Speed: Building Reports That Fly

In the beginning….Note: no real data is used in this presentation

Page 68: The Need for Speed: Building Reports That Fly

Account information is very slow: Sales Rep

Page 69: The Need for Speed: Building Reports That Fly

Sales information is too overwhelming: Sales Rep

Page 70: The Need for Speed: Building Reports That Fly

Dashboards are slow or timing out: Execs

Page 71: The Need for Speed: Building Reports That Fly

Approach to troubleshooting

Page 72: The Need for Speed: Building Reports That Fly

Reports and dashboards are slow or timing out

Page 73: The Need for Speed: Building Reports That Fly

Storage usage

Page 74: The Need for Speed: Building Reports That Fly

Reduce data volume

Page 75: The Need for Speed: Building Reports That Fly

Reduce data volume

Batch jobs

Data Sampling Frequency

Page 76: The Need for Speed: Building Reports That Fly

Compound keys

Page 77: The Need for Speed: Building Reports That Fly

Workbench

Page 78: The Need for Speed: Building Reports That Fly

Workbench, Deleted records

Page 79: The Need for Speed: Building Reports That Fly

Update instead of delete/reload

Full Nightly Delete & Reload

Update/Insert

Upsert

Page 80: The Need for Speed: Building Reports That Fly

Data loads failing

Page 81: The Need for Speed: Building Reports That Fly

Error logs

Page 82: The Need for Speed: Building Reports That Fly

Rollup summary fields

Page 83: The Need for Speed: Building Reports That Fly

A littlehousekeeping

Page 84: The Need for Speed: Building Reports That Fly

Report tuning

Page 85: The Need for Speed: Building Reports That Fly

Governance

Page 86: The Need for Speed: Building Reports That Fly

In the end….

Page 87: The Need for Speed: Building Reports That Fly

Account information is timely: Sales Rep

Page 88: The Need for Speed: Building Reports That Fly

Sales information is useful: Sales Rep

Page 89: The Need for Speed: Building Reports That Fly

Dashboards are responsive: Execs

Page 90: The Need for Speed: Building Reports That Fly

Storage usage: greatly reduced

Page 91: The Need for Speed: Building Reports That Fly
Page 92: The Need for Speed: Building Reports That Fly

Session Summary

Page 93: The Need for Speed: Building Reports That Fly

Building Reports That Fly• Govern users access to reports and data• Manage reporting frequency• Add at least one selective filter per report

Page 94: The Need for Speed: Building Reports That Fly

Related DevZone Hands-on, Mini-workshop

Wednesday 1:00-1:45 PM

Thursday 1:00-1:45 PM

Page 95: The Need for Speed: Building Reports That Fly

We want to hear from YOU!

Please take a moment to complete our session survey

Surveys can be found in the “My Agenda” portion of the Dreamforce app

Page 96: The Need for Speed: Building Reports That Fly