Re: [PERFORM] Under the hood of views

2009-08-13 Thread Greg Stark
On Fri, Aug 14, 2009 at 12:04 AM, David Kerr wrote: > On Thu, Aug 13, 2009 at 05:28:01PM +0100, Richard Huxton wrote: > - David Kerr wrote: > - > > - >create view test as > - >select a,b,c,d,e,f,g from testtable; > - > > - >select a from test; > - > > - >(does the engine retrieve b-g?) > - > - Shou

Re: [PERFORM] Under the hood of views

2009-08-13 Thread David Kerr
On Thu, Aug 13, 2009 at 05:28:01PM +0100, Richard Huxton wrote: - David Kerr wrote: - > - >create view test as - >select a,b,c,d,e,f,g from testtable; - > - >select a from test; - > - >(does the engine retrieve b-g?) - - Shouldn't - the query just gets rewritten macro-style. I don't think it - el

Re: [PERFORM] Under the hood of views

2009-08-13 Thread Richard Huxton
David Kerr wrote: create view test as select a,b,c,d,e,f,g from testtable; select a from test; (does the engine retrieve b-g?) Shouldn't - the query just gets rewritten macro-style. I don't think it eliminates joins if you don't need any columns, but that's not possible without a bit of an

[PERFORM] Under the hood of views

2009-08-13 Thread David Kerr
developer came by and asked me an interesting question. If he has a view with 20 columns in it, and he selects a specific column from the view in his query. Does the engine when accessing the view return all columns? or is it smart enough to know to just retrive the one? example: create view