Derived tables are pretty slow in MySQL normally.