Re: Mysterious performance of query because of plsql function in where condition

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Peter Alberer <h9351252(at)obelix(dot)wu-wien(dot)ac(dot)at>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Mysterious performance of query because of plsql function in where condition
Date: 2004-07-02 13:07:10
Message-ID: 20040702130710.GA25007@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Jul 02, 2004 at 09:48:48 +0200,
Peter Alberer <h9351252(at)obelix(dot)wu-wien(dot)ac(dot)at> wrote:
>
> Postgres seems to execute the function "submission_status" for every row
> of
> the submissions table (~1500 rows). The query therefore takes quite a
> lot
> time, although in fact no row is returned from the assignments table
> when
> the condition package_id=949589 is used.

If submission_status is invertable you might want to create the
inverse function, mark it immutable and call it with 'closed'.
That would allow the optimizer to compare submissions.submission_id
to a constant.

Another option would be be to create an index on
submission_status(submissions.submission_id).

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2004-07-02 13:12:58 Re: BUG #1186: Broken Index?
Previous Message Jeff 2004-07-02 11:52:27 Re: Mysterious performance of query because of plsql function in where condition