KNOWLEDGE BASE

Inconsistent View Count Metrics in the Tableau Server Internal Postgres Database Tables


Published: 27 Aug 2016
Last Modified Date: 19 Sep 2017

Issue

Views counts may not match when calculated using views_stats, historical_events, and view_metrics_aggregations.

view_metrics_aggregations
SELECT sum(view_count) FROM view_metrics_aggregations v where v.view_id in (select id from views where workbook_id='<workbook id>');
For more information about this table, see view_metrics_aggregations in Tableau Help.  

historical_events
select count(*) from historical_events e 
where e.hist_workbook_id in (select id from hist_workbooks w where w.name = '<workbook name>')

AND historical_event_type_id='84';

(historical_event_type_id 84 refers to view access events)
For more information about this table, see historical_events in Tableau Help.  

views_stats
select sum(nviews) from views_stats v where v.view_id in (select id from views where workbook_id='<workbook id>');
For more information about this table, see view_stats in Tableau Help. 

 

Environment

  • Tableau Server 
  • internal PostgreSQL

Resolution

Discrepancies in the view count between these tables is not unexpected, given differences in the population logic of the tables. It is recommended to use the view_count_aggregations table for view count reporting, if needed outside of the built in Traffic to Views admin view.

Cause

These discrepancies can occur for the following reasons:
  • Differences in view hit reporting
  • Guest user access
  • Age of data (hist* tables hold 6 months by default)
  • Changes to the database through product updates

Additional Information

In Tableau 9.3, we added the Content Analytics feature (which shows the hit counts in the Tableau Server browser interface). This is tracked in view_metrics_aggregations table (and later datasource_metrics_aggregations). Its purpose is to give us hit counts over the last N days/months/years. This does include Guest views. 
Did this article resolve the issue?