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).