Re: function optimization ???

From: Brent Verner <brent(at)rcfile(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: function optimization ???
Date: 2001-01-24 22:45:07
Message-ID: 20010124174507.A28610@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24 Jan 2001 at 12:14 (-0500), Tom Lane wrote:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > calling it as:
| > SELECT p.*, p.book_info.title FROM pricing p WHERE vista_ans='POD';
| > background and observation:
| > the pricing table is fairly large, but only a small number meet
| > "WHERE vista_ans='POD'". I can select all where vista_ans='POD'
| > very quickly (.2 sec), but adding in the get_book(pricing) call
| > slows this down to about 20sec. I can, with an external sql query,
| > select all of the desired records in about 1 sec, so it appears
| > to me that the function is being called regardless of whether
| > or not the WHERE clause is being satisfied.
|
| This conclusion is absolutely false: the SELECT target list is NOT
| evaluated except at rows where the WHERE condition is satisfied.
|
| I suspect the real problem is that the select inside the function
| is not being done as efficiently as you'd like.

yes, this is indeed the case. Sorry for the noise, my 'with an external
query' case was a broken product of sleep-dep :\.

thanks.
brent

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-01-24 23:03:23 Re: LEFT JOIN in pg_dumpall is a bug
Previous Message Bruce Momjian 2001-01-24 22:42:04 Re: Open 7.1 items