All pages
1 of 2

Loading...

Loading...

How Do CopyStorm Views Work?

The Salesforce API presents all SObjects (Account,Contact, etc.) as tables to the outside world even though quite a number of SObjects are really subsets/views of other SObjects. The most common example is Salesforce feed tables — there are dozens of feed tables (AccountFeed, ContactFeed, etc.) that are simply views of the table that contains all feeds: FeedItem.

  • The AccountFeed table is really a view on the base table FeedItem.

    • SELECT * FROM FeedItem WHERE parentId IS an Account Record.

There are also cases where the Salesforce API does not support a direct query on an SObject but the SObject can be constructed from other SObjects.

  • The ActivityHistory table is a union of the Event and Task SObjects but cannot be queried directly using SOQL.

There are other issues of this kind, but lets get to the important part. When Database Views are enabled in CopyStorm, then CopyStorm will use views in the target database rather than copying a table. This can lead to much faster backups for each table that can be represented as a view.

Database Views are enabled by default in CopyStorm and when enabled:

  • If a Salesforce table does not exist in the target database and can be represented as a view, then CopyStorm will create it as a view.

  • If a Salesforce table already exists in the target database, then CopyStorm will not re-create it as a view but will continue to treat it as a table.

If Database Views are disabled in CopyStorm:

  • Database Views will not be created for new tables.

  • If a Database View already exists in the target database, then CopyStorm will not change it.

The toggle that enables/disables Database Views is found in the configuration section of the CopyStorm Configuration tab.

This section is for anyone wanting to know exactly how the logic for determining whether a Database View should be used works.

How to Enable Database Views

Implementation Details

Case 1: Use Database View = TRUE

Case 2: Use Database Views = FALSE

Database Schema

How to Convert to Database Views

If your CopyStorm database was created before Database Views were introduced then are likely many database tables in your backup that could be represented as database views instead. For safety, CopyStorm will not convert an existing table to a view UNLESS you follow the instructions in this article.

The DBA Approach

The technique to force CopyStorm to switch to a database view for a table is simple:

  • Manually drop the table in the CopyStorm database that should be a view. The next time CopyStorm runs it will create the view.

For example:

  • DROP TABLE AccountFeed

  • DROP TABLE ActivityHistory

will cause CopyStorm to recreate AccountFeed and ActivityHistory to views the next time CopyStorm runs.

The tool provides a simple GUI for dropping tables from a CopyStorm database.

  • Go to the documentation for the

  • All tables ending with Feed. Examples:

    • AccountFeed

    • MyCustomObject__Feed

  • ActivityHistory

AccountUserTerritory2View

The Non-DBA Approach

What Tables Can Be Converted To Database Views?

CopyStorm/Medic Table Editor
CopyStorm/Medic Table Editor