From: Martin Gainty Date: February 9 2009 5:25pm Subject: RE: MySQL View List-Archive: http://lists.mysql.com/mysql/216215 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_3a62ee2a-1363-47ec-9e8c-3b2a8fb68548_" --_3a62ee2a-1363-47ec-9e8c-3b2a8fb68548_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable My current understanding of the delta between Views and Temporary Tables Views are read only results from 1 or more tables ..in Oracle they are stor= ed in TEMP tablespace http://www.psoug.org/reference/views.html Temporary Tables are tables which are created/updated/inserted and exist on= ly for the duration of your client session Oracle calls these Global Temporary Tables http://www.psoug.org/reference/gtt.html HTH Martin=20 ______________________________________________=20 Disclaimer and confidentiality note=20 Everything in this e-mail and any attachments relates to the official busin= ess of Sender. This transmission is of a confidential nature and Sender doe= s not endorse distribution to any party other than intended recipient. Send= er does not necessarily endorse content contained within this transmission.= =20 > From: steve@stripped > To: baron@stripped > CC: mysql@stripped > Subject: RE: MySQL View > Date: Mon=2C 9 Feb 2009 10:10:45 -0600 >=20 >=20 >=20 > > -----Original Message----- > > From: baron.schwartz@stripped [mailto:baron.schwartz@stripped] On > > Behalf Of Baron Schwartz > > Sent: Monday=2C February 09=2C 2009 9:19 AM > > To: Steven Buehler > > Cc: mysql@stripped > > Subject: Re: MySQL View > >=20 > > On Mon=2C Feb 9=2C 2009 at 9:41 AM=2C Steven Buehler > > wrote: > > > Ok=2C I just saw a post about using view's in mysql. I tried to look > > it up > > > and found how to use it=2C but my question is: what is a view and why > > would > > > you use it? Is it like a temporary table? Does it write a new > > database to > > > the disk or use memory? > >=20 > > A view is a piece of SQL whose result can be queried like a table. It > > stores no data=3B the results are always generated as the query > > executes. In some cases it does use a temporary table to hold the > > result and then query against it=3B in other cases it merges the > > original query's SQL and the view's SQL together and then executes the > > resulting query. > >=20 > > Why use it? To abstract a complex bit of code away for simplicity. > > To grant permissions in a certain way (you can grant access to the > > view and deny access to the underlying table). > >=20 > > There's a lot of complexity to it though=2C in terms of how to use view= s > > correctly and get good performance. I think the manual goes over it > > in good detail=2C and our book High Performance MySQL 2nd Edition has > > probably the best exploration of it otherwise. > >=20 > > Baron >=20 > Baron=2C Thank You > Questions: > 1. The view is temporary then? So it kind of uses it "in place of" a > temporary table? > 2. Does it go away after the query or after the mysql_close? >=20 > I am going to have to go to the book store and get your book too. >=20 > Thanks > Steve >=20 >=20 > --=20 > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dmgainty@stripped= om >=20 _________________________________________________________________ Windows Live=99: Keep your life in sync.=20 http://windowslive.com/howitworks?ocid=3DTXT_TAGLM_WL_t1_allup_howitworks_0= 22009= --_3a62ee2a-1363-47ec-9e8c-3b2a8fb68548_--