Re: [GENERAL] Opptimizing projections containing unused columns

2008-10-16 Thread 陈伟楠
Andrus,Hi! 1.From the query plan,it makes no difference. 2.PostgreSQL 8.0+ will not exclude columns c3..c20 while executing. 3.I just make a test,From query plan or executing time,it makes no difference. I'm from China.I hope you could see what I mean :) ==

Re: [GENERAL] Opptimizing projections containing unused columns

2008-10-15 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > Is it OK to put all filters to outer query WHERE clase? > Or should I move as many filter conditions as possible to inner query so > that inner query returns 1 records instead of 50 records. > Is there difference in perfomance if inner query returs l

Re: [GENERAL] Opptimizing projections containing unused columns

2008-10-15 Thread Andrus
Tom, Don't worry about it. All modern Postgres versions ignore columns that aren't actually used in the query --- at least for examples as simple as this one. In cases where you intentionally defeat optimization (eg via OFFSET 0 in a sub-select) it's possible that the sub-select will compute a

Re: [GENERAL] Opptimizing projections containing unused columns

2008-10-15 Thread Grzegorz Jaśkiewicz
looks like most ppl nowdays have two simple problems, and try to work against it. Instead they all should focus on getting their data organized properly, and queries writeen for project before they start to code other stuff. The problems are: trying to outsmart db, still belive that you can catch

Re: [GENERAL] Opptimizing projections containing unused columns

2008-10-15 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > I have lot of autogenerated from projection queries in form > SELECT source.c1, source.c2, t1.col1, t1.col2, ... > FROM (SELECT c1, c2, c3, . , c20 FROM ... WHERE ... ) source > LEFT JOIN t2 USING (somecolumn) > Main SELECT uses only few columns (source.c1