Justin’s A workaround for the performance problems of TEMPTABLE views post on mysqlperformanceblog.com reminded me of a solution I once saw on a customer’s site.
The customer was using nested views structure, up to depth of some 8-9 views. There were a lot of aggregations along the way, and even the simplest query resulted with a LOT of subqueries, temporary tables, and vast amounts of data, even if only to return with a couple of rows.
While we worked to solve this, a developer showed me his own trick. His trick is now impossible to implement, but there’s a hack around this.
Let’s use the world database to illustrate. Look at the following view definition: Continue reading » “Views: better performance with condition pushdown”