Views and subqueries

From: Stefan Ram <ram_at_zedat.fu-berlin.de>
Date: 11 Oct 2015 15:42:11 GMT
Message-ID: <Views-20151011163613_at_ram.dialup.fu-berlin.de>



  It might be possible that I do not understand the   implementation of views in MySQL!

  IIRC, in MySQL, views cannot contain subqueries. And some   parties say that views might degrade performance.

  But, if I had to implement views, I'd implement subqueries   first, then implement view by inserting a view that is used   as a subquery recursively until there are no more views used.   Then do a »global« optimization of the resulting query.

  But when views cannot contain subqueries this seems to hint   at that they are not implemented as above (otherwise   subqueries would be no problem). Also, when implemented as   above, a view should never be slower than a subquery. So it   seems that views are not implemented by simply inserting   them as subqueries. Why not? And how /are/ they implemented? Received on Sun Oct 11 2015 - 17:42:11 CEST

Original text of this message