Salesforce Object with _hd suffix?

The _hd suffix stands in for 'Historical Data'. When Historical Trending is set up for an object, the customobject__c_hd will show up in the Developer Console. There isn't much in the way of documentation on how Salesforce is handling this on the backend that I can find, just the Setup and Reporting documentation linked above.


Here is some more detail on __hd SObjects:

I enabled Opportunity with Historical trending on 2015-03-12. I took one of my Opportunities where there had been changes in Amount over time and executed this query:

SELECT ValidFromDate,ValidToDate, Amount__hpr,Amount__hst,ParentId 
   FROM Opportunity__hd where parentid = '006d000000Q0dxiAAB'

Observe the results:

enter image description here

What you see is a row for many datetime ranges reflecting changes made to the Opportunity

  • Amount__hpr is the value at the start of the Datetime range
  • Amount__hst is the value at the end of the Datetime range
  • ParentId is the parent object being tracked with historical trending

Note also that even though I enabled Opportunity with Historical Trending on 2015-03-12; SFDC went back in time and (presumably) looked at my Field History tracking to populate the rows prior to 2015-03-12

Why are there seemingly duplicate rows where the Amount didn't change from range1 to range2?

By repeating the query but this time including the other fields being tracked, we see that a row is written to Opportunity__hd every time one of the tracked fields changes. When the row is written, all of the (up to 8) tracked fields' previous/current value since the last row written are emitted in a new row.

One begins to see why SFDC limits this to up to 8 tracked fields and only up to 3 months of historical data.

SELECT ValidFromDate,ValidToDate,
       Amount__hpr, Amount__hst,
       CloseDate__hpr,CloseDate__hst,
       Forecast_Status__c_hpr,Forecast_Status__c_hst,
       ParentId 
  FROM Opportunity__hd where parentId ='006d000000Q0dxiAAB'

enter image description here