List:MySQL on Win32« Previous MessageNext Message »
From:Michael Widenius Date:October 15 1999 12:05am
Subject:RE: Several problems
View as plain text  
Hi!

>>>>> "jostos" == jostos  <iso-8859-1> writes:

jostos> First of all, I want to thank you for your responses, you have really cleared
> up a lot of things.
jostos> A "VIEW" as I understand it is like having a table which is acually the result
> of a SELECT query. It is generally used like a subquery in the following way

jostos> SELECT a.Fields,... , b.Fields,...
jostos> FROM TABLE a, VIEW b
jostos> WHERE a.something = b.Somethig

jostos> A subquery equivalent would be
jostos> SELECT a.Fields,... , b.Fields,...
jostos> FROM TABLE a, (SELECT ....) b     <select instead of view>
jostos> WHERE a.something = b.Somethig

I know what views are :)
My main question was why you needed views (to solve your current problem)

jostos> An Idea of implementation woud be to identify and process the "VIEW SELECT"
> first and create a temporary table. If the VIEW SELECT" has a DISTINCT or GROUP BY clause,
> it should use those fields as a primary index for the temporary table. If it has a ORDER
> BY clause, it could be used as a secondary not unique index. Once the temporary table is
> done with its corresponding indexes, the actual Query would then use the temporary table
> as it would a normal table, optimizing according to the indexes created.

jostos> Considering what has already been done and exists in MySql, I don't think this
> should be too complicated to implement, just putting together what has already been done.
> Though I could be totally wrong.

No this, wouldn't be that hard.  The problem that without any
optimization, the above approach would almost useless for tables of
more than a few rows :(

To have views that is a SELECT over more than one table, one first
needs a VERY good sub query optimizer!  Another problem with general
views is to make an updateable cursor on them..

Because of this we don't plan to support general views until we have a 
decent sub query optimizer..

Regards,
Monty

Thread
Several problemsJosé Ostos Turner12 Oct
RE: Several problemsJosé Ostos Turner12 Oct
  • RE: Several problemsMichael Widenius12 Oct
RE: Several problemsJosé Ostos Turner14 Oct
  • Re: Several problemsMike Albanese14 Oct
  • RE: Several problemsMichael Widenius14 Oct
RE: Several problemsJosé Ostos Turner14 Oct
RE: Several problemsMichael Widenius15 Oct