Tableau-Server-Postgres-Queries icon indicating copy to clipboard operation
Tableau-Server-Postgres-Queries copied to clipboard

nviews - How long?

Open c00lc0le opened this issue 3 years ago • 0 comments

I couldn't find anything in the Tableau data dictionary about how long the data is stored for [nviews]. When pulling from "views_stats" the date that is presented (as the [time] field) appears to be the most recent access date from the user. I've been told that [nviews] is a tally of 180 days (by workbook id, user id, site id, and device type) regardless of the most recent access date/time, but I can't find it documented anywhere.

It might be helpful to update the queries that use the [nviews] field to notate that [time] and [nviews] are not directly related. In other words: One cannot use the [time] field to trend out how many times a user views a view over time; only the max time and total number of views are presented. Unknown what "total" means in relation to time.

Example queries from our server (with actual values adjusted for security purposes) proving the point.

-- I cannot find any documentation that indicates how to trend view/workbooks/site usage by date by user.
-- We can get view/workbook/site usage by date.
-- We can get MAX date by user by view/workbook/site.
-- There may be another table/view we could use, but I'm unable to locate it in https://tableau.github.io/tableau-data-dictionary/2021.2/data_dictionary.htm?_fsi=urL1jOre
-- Also refernced https://github.com/isajediknight/Tableau-Server-Postgres-Queries

select
user_id, view_id, site_id,
count(1) view_count
from views_stats
group by user_id, view_id, site_id
order by count(1) desc
-- We see a max of 5 records for the user + view + site combination (the only other fields in the table other than time)
-- If this were a daily view, we'd see more than 5 for a single user + view + site combination

select 
min(time)
from views_stats
--2019-02-01 12:11:11 returns as min(time)
--Defintely more than 180 days of data in the table
--Though it is possible the the key combination (user_id, view_id, site_id) is updated to reflect the most recent view

select
*
from views_stats
where user_id = 762951
and view_id = 68168
-- Only showing 5 records - 2 for 'desktop device_type' and then 1 each for other device_types - regardless of time
-- This indicates that this is NOT a table showing number of views by user for each view for each date

c00lc0le avatar Aug 02 '21 19:08 c00lc0le