Inkeye;10909653 wrote:There is some overhead to using Views, particularly the more complex they get. Probably in a PHP application, there is little utility in them (unless you just want to make your PHP's query-writing simpler); but when analyzing data, they can be very, very handy.
Note that this is provably untrue for PostgreSQL. A view is simply a query wrapper there, and it's exactly the same performance-wise as if you'd just typed out the giant SQL by hand. In MySQL once views get complex enough, they don't have a little overhead, they have a lot of overhead, as in they materialize the entire view before pushing down the where clause etc. I.e. a complex enough view in mysql can bring the machine to its knees, and therefore one of the best uses for a view, hiding compelx queries from sight, is not really usable.
Most of the time I use views it's to allow other users, especially the not quite so experienced ones, to run complex queries with a simple select * from view where xxx=yyy kind of syntax.