Optimizing queries with projected columns - Mailing list pgsql-general

From Andrus
Subject Optimizing queries with projected columns
Date
Msg-id gd4gcq$27kp$1@news.hub.org
Whole thread Raw
List pgsql-general
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 and source.c2 in this sample)
from source projection.
Inner table may have up to 500000 rows.

Does selecting of unused columns ( c3 ... c20) affect to query prefomance ?
Will PostgreSQL 8.0+ automatically exclude columns c3 .. c20 while executing
query ?
Or should I make sql builder much more sophisticated so that it will not
generate columns c3 .. c20 when
it creates sql ?
I read 8.4 WITH documentation and this describes somewhat that PostgreSQL
can discard unused columns automatically but this is not clear. I havent
found exact doc about this. I havent way how to determine this using EXPLAIN
or similar command.

Andrus.


pgsql-general by date:

Previous
From: Josh Williams
Date:
Subject: Re: psql: what's the SQL to compute the ratio of table sizes?
Next
From: "Andrus"
Date:
Subject: How to get schema name which violates fk constraint