PrevUpHomeNext

Performance Tip: Avoid Repeated Subexpressions

If you are using select() to build a query, upon which you will build further with where() or order(), and if some expression that occurs as an argument to select() is an exact duplicate of an expression that occurs in an argument to where() or order() (possibly as a subexpression), then consider building that expression just once, and holding it in a const exprn_mapper variable that you use and reuse. Using copies of the original is fine too; what matters is to avoid assembling it from parts multiple times.

If you follow this advice, then quince will use a column alias to avoid repeated evaluations of the expression in the SQL.


PrevUpHomeNext