WHERE order

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: WHERE order
Date: 2003-08-26 17:53:49
Message-ID: 1061920428.4370.25.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It would appear that in 7.4 the order of clauses in WHERE affects the
execution time (not output if AND).

I would think that a simple optimization would be to push off evaluation
of a subplan whenever possible by re-arranging AND statements.

In the below example, it gives an order of magnitude speed increase on a
small dataset.

Attachment Content-Type Size
long.query text/plain 513 bytes
long.explain text/plain 1.5 KB
short.explain text/plain 1.5 KB
short.query text/plain 513 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera Munoz 2003-08-26 18:05:18 Re: Date input changed in 7.4 ?
Previous Message Jenny - 2003-08-26 17:48:18 Re: table-level and row-level locks.