Find when dashboards were last accessed

Is there a query or an easy way to find out when dashboards were last accessed? We have so many dashboards and I think its slowing our system down. Problem is, I dont know if they are all relevant anymore. I want to be able to sort and find dashboards that have not been accessed or viewed in a long time. This would prevent me from asking about hundreds of dashboards! Is there an easy way to do this? I looked in the audit feature of metabase but couldnt see anything that would provide that information. Thanks!

Hi @emosse
Have a look at Metabase Metadata SQL

@flamber thank you. However, how do I start? Its asking me to select a database. Is there a way around this? Where would report_dashboard be in? Also, none of these are last views. Does that exist as a field? I cant tell because I cant look at these tables

@emosse You would need to make a query that joins in view_log and perhaps query_execution depending on what you're looking for.

But Metabase is not slow because there's a few hundred dashboards that are unused.
The problem is elsewhere, likely in your setup or hosting/scaling.

Post "Diagnostic Info" from Admin > Troubleshooting.

I dont have view_log in database. Where would this reside?

I realize that it may not be slow because of dashboard count. To be more clear, this is related to overall clean up so we dont have hundreds of dashboards floating out there

@emosse You need to connect to the Metabase application database. I can guarantee that you have a view_log table, otherwise Metabase wouldn't work.

The Audit functionality in the Pro/Enterprise provides you with information about how many views a dashboard has.

yes I saw that audit has how many views, but i would like to know last viewed. If a dashboard hasnt been viewed in 2 years then it doesnt really matter how many times its been viewed because no one is looking at it

I had this query today, specifically it seemed difficult to tell when a "public" link to a dashboard had been loaded.

The View_Log table loads the cards of the dashboard when it is viewed on a public link but not the dashboard itself.

Here's my current solution

-- using view log table see when cards were last accessed and map the card ids to dashboard ids. 
-- (none of my cards are on more than one dash)
with joined as (
        view_log.model_id as Model_ID,
        date(max(view_log.timestamp)) as Last_Viewed,
        report_dashboardcard.dashboard_id as Dashboard_ID 
        left join report_dashboardcard on view_log.model_id = report_dashboardcard.card_id 
        view_log.model = 'card'
        and view_log.user_id is null
    group by 

-- get rid of dashboards that are archived
dashboards as (
    select as Dashboard_ID, as Dashboard_Name
        report_dashboard.archived = false

-- join two above tables to link dashboard name to dashboard id
    dashboards.dashboard_name as Dashboard_Name,
    max(joined.last_viewed) as last_viewed 
    inner join dashboards on joined.dashboard_id = dashboards.dashboard_id
group by 
order by 
    last_viewed desc