The Rewriter Query Rewrite Plugin 5.6.4.3 Rewriter Query Rewrite Plugin Reference Rewriter Query Rewrite Plugin Rules Table •The  Rewriter  rules table in the  query_rewrite  database • Rewriter  procedures and functions • Rewriter  system and status variables The following discussion serves as a reference to these elements associated with the  Rewriter  query rewrite plugin: The  rewrite_rules  table in the  query_rewrite  database provides persistent storage for the rules that the  Rewriter  plugin uses to decide whether to rewrite statements. Users communicate with the plugin by modifying the set of rules stored in this table. The plugin communicates information to users by setting the table’s  message  column. Note The rules table is loaded into the plugin by the  flush_rewrite_rules  stored procedure. Unless that procedure has been called following the most recent table modification, the table contents do not necessarily correspond to the set of rules the plugin is using. The  rewrite_rules  table has these columns: • id • pattern • replacement • pattern_database • enabled The rule ID. This column is the table primary key. You can use the ID to uniquely identify any rule. The template that indicates the pattern for statements that the rule matches. Use  ?  to represent parameter markers that match data values. The database used to match unqualified table names in statements. Qualified table names in statements match qualified names in the pattern if corresponding database and table names are identical. Unqualified table names in statements match unqualified names in the pattern only if the default database is the same as  pattern_database  and the table names are identical. The template that indicates how to rewrite statements matching the  pattern  column value. Use  ? to represent parameter markers that match data values. In rewritten statements, the plugin replaces ?  parameter markers in  replacement  using data values matched by the corresponding markers in pattern . Whether the rule is enabled. Load operations (performed by invoking the  flush_rewrite_rules() stored procedure) load the rule from the table into the  Rewriter  in-memory cache only if this column is YES . This column makes it possible to deactivate a rule without removing it: Set the column to a value other than  YES  and reload the table into the plugin. 1093