8.1 vs 8.2.1 view optimization

From: Nathan Bell <nathanb(at)actarg(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: 8.1 vs 8.2.1 view optimization
Date: 2007-01-16 21:24:53
Message-ID: 45AD42A5.8000705@actarg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Firing up 8.2.1 I notice that sub-items in a view are optimized out if
they aren't being selected.

For example, "select item1, item2 from a_view" would take just as long
as "select item1, item2, item3, item4 from a_view"

This isn't usually a problem, but if item3 or item4 are significantly
more complex (and slow) than item1 and item2 this is a big problem. In
8.1 and previous versions of postgresql this wouldn't happen. Is there
some setting that can be set to re-enable this feature?

Attached is a small sql script that shows the problem. When run on 8.2
or 8.2.1 it takes twice as long as when run on 8.1 because of this
un-feature. This can be run on a completely fresh, blank database and it
will create all of the languages, tables, etc that it needs. It will
also clean up everything afterwards. The funciton "slow_function" is for
illistration purposes only, and is made only to take time.

Thanks in advance for any help,

Nathan Bell
IT Engineer
Action Target, Inc.

Attachment Content-Type Size
broken.sql text/x-sql 978 bytes

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-01-16 21:32:40 Re: Dynamic loading of Perl Code in Postgres functions
Previous Message Stephan Szabo 2007-01-16 20:59:33 Re: Multi-column constraint behaviour