Find where specific function is used in MySQL database

Query below list views where specific function is used.


Query works under MySQL 8.0.13 or newer version


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,


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


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

Sample Results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
There are no comments. Click here to write the first comment.