Use the SQL Definer

Previous Next

The use of the SQL Definer is recommended.

Background

In general, parsed SQL statements can be re-used if two SQL statements are issued in exactly the same way. The Rules Engine already optimizes this by generating many default queries always in the same way. You can further benefit from cursor re-use on the client computer and, depending on your RDBMS, on the server.

For these reasons, be consistent in writing SQL statements. You can do this by setting guidelines about the order in which column conditions are listed in clauses or by using aliases. By using the SQL Definer, you increase chances of SQL statements being identical when identical commands are intended.