Richard Huxton <dev@archonet.com> writes:
> Which says to me that your form is fine. Testing says otherwise, so there must
> be some element of the query that is not being accounted for in EXPLAIN
> ANALYSE.
To wit, planning time. EXPLAIN ANALYZE only counts execution time.
And planning time on a 13-way join is going to be nontrivial ---
especially compared to execution against trivial-size tables.
You can turn on some query stats logging (I forget the SET-variable
names) to get a feeling for the relative costs of planning and
execution; but usually planning drops into the noise once you start
looking at production-sized cases.
regards, tom lane