pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Peter Alberer <h9351252@obelix.wu-wien.ac.at>
Cc: pgsql-performance@postgresql.org
Subject: Re: Mysterious performance of query because of plsql function in where condition
Date: Fri, 2 Jul 2004 08:07:10 -0500
Message-ID: <20040702130710.GA25007@wolff.to> (raw)
In-Reply-To: <000001c46009$062e8260$5be0d089@ekelhardt>
References: <000001c46009$062e8260$5be0d089@ekelhardt>

On Fri, Jul 02, 2004 at 09:48:48 +0200,
  Peter Alberer <h9351252@obelix.wu-wien.ac.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).



view thread (4+ messages)  latest in thread

Message-ID: <20040702130710.GA25007@wolff.to>
Permalink:  ../20040702130710.GA25007@wolff.to/
Also on:    postgresql.org/message-id/20040702130710.GA25007@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bruno@wolff.to, h9351252@obelix.wu-wien.ac.at
  Subject: Re: Mysterious performance of query because of plsql function in where condition
  In-Reply-To: <20040702130710.GA25007@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox