homepage Welcome to WebmasterWorld Guest from 54.205.73.176
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
mysql views
Sandro87

5+ Year Member



 
Msg#: 4105703 posted 1:21 pm on Mar 27, 2010 (gmt 0)

Hello,
I really don't understand the usage and advantages of VIEWS.

I mean, as I got it, the views are non-indexed temp table that are dropped after the PHP script ends. Then what is the advantage of using it?

 

syber

10+ Year Member



 
Msg#: 4105703 posted 2:54 pm on Mar 27, 2010 (gmt 0)

VIEWS are not temp tables, they are stored SELECT statements. Think of them as virtual tables.

When you reference a view, the stored select statement is executed. Views allow you to create complex queries that you can treat as a table. The underlying data remains in the tables referenced in the view definition. Indexes for those tables are still utilized.

Sandro87

5+ Year Member



 
Msg#: 4105703 posted 2:41 pm on Mar 29, 2010 (gmt 0)

what happens if 2 users run the same script at the same time? The view will be overwritten?

syber

10+ Year Member



 
Msg#: 4105703 posted 2:08 pm on Mar 30, 2010 (gmt 0)

The view does not store any data. The two users see the same result set as if they had typed in the query directly.

bizminder



 
Msg#: 4105703 posted 9:19 am on Apr 7, 2010 (gmt 0)

However with exclusive locks two users will never be able to run the same script simultaneously.

syber

10+ Year Member



 
Msg#: 4105703 posted 10:57 am on Apr 7, 2010 (gmt 0)

SELECT statements don't acquire exclusive locks.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved