Find where specific function is used in MySQL database

Query below list views where specific function is used.

Note

Query works under MySQL 8.0.13 or newer version

Query

select table_schema as database_name,
       table_name as view_name,
       specific_name as routine_name
from information_schema.view_routine_usage 
where table_schema not in ('performance_schema', 'sys',
                           'information_schema', 'mysql')
      and specific_name = 'function_name'  -- put your function name here
order by database_name,
         view_name;

Columns

  • database_name - database (schema) name
  • view_name - name of view which use specific function in definition
  • routine_name - name of searched function

Rows

  • One row represents one view
  • Scope of rows: all views that are using provided function
  • Ordered by database name, view name

Sample Results