Skip to main content
Documents
Clauses StatementsKeywordsExpressionsFunctionsIndexesPerformance Optimization

MySQL SHOW PROCEDURE STATUS Statements

The `SHOW PROCEDURE STATUS` statement in MySQL is used to display information about stored procedures. It provides details such as the database name, procedure name, type, creation and modification dates, and other metadata. Note that this statement specifically retrieves information about stored procedures, not functions.

Usage

The `SHOW PROCEDURE STATUS` statement is utilized to gain insights into the characteristics and status of stored procedures within a MySQL database. This is particularly useful for database administration and management tasks, and it retrieves information specific to the current MySQL instance.

SHOW PROCEDURE STATUS
[LIKE 'pattern'];

In this syntax, the optional `LIKE 'pattern'` clause can filter the results to match specific procedure names. This clause uses standard SQL pattern-matching techniques.

Result Set Columns

The output of `SHOW PROCEDURE STATUS` includes the following columns:

  • Db: The database name.
  • Name: The name of the procedure.
  • Type: The object type, which is always `PROCEDURE` for this statement.
  • Definer: The account that defined the procedure.
  • Modified: The date and time when the procedure was last modified.
  • Created: The date and time when the procedure was created.
  • Security_type: Indicates how the procedure executes with respect to user privileges.
  • Comment: Any comments associated with the procedure.

Examples

1. Display All Procedures

SHOW PROCEDURE STATUS;

This statement retrieves information about all stored procedures available in the current MySQL instance.

2. Filter Procedures by Name

SHOW PROCEDURE STATUS LIKE 'getCustomer%';

Here, the statement lists stored procedures whose names begin with `getCustomer`, allowing for targeted retrieval of procedure metadata.

3. Specific Database Procedures

SHOW PROCEDURE STATUS WHERE Db = 'sales';

This example filters the procedures to only those that exist within the `sales` database, making management of database-specific procedures easier.

Tips and Best Practices

  • Use specific patterns. Utilize the `LIKE` clause to narrow down results and improve readability, especially when dealing with numerous procedures. This can also improve query performance.
  • Combine with other queries. Use the output of `SHOW PROCEDURE STATUS` to inform decisions in subsequent administrative queries or operations.
  • Regular monitoring. Regularly inspect procedure statuses to ensure they are up-to-date and functioning as intended.
  • Document procedures. Keep comments and proper documentation for procedures to understand their purpose and structure when reviewing their status.
  • Consider permissions. Ensure the user executing `SHOW PROCEDURE STATUS` has the necessary permissions to view procedure metadata.
  • Explore `INFORMATION_SCHEMA`. For more granular control and comprehensive filtering, consider using `INFORMATION_SCHEMA.ROUTINES`.
  • Version-specific details. Be aware that the output may vary slightly based on the MySQL version and configuration.

SQL Upskilling for Beginners

Gain the SQL skills to interact with and query your data.
Start Learning for Free