pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Treat <xzilla@users.sourceforge.net>
To: Jared Carr <jared@89glass.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: A question on the query planner
Date: 02 Dec 2003 12:16:21 -0500
Message-ID: <1070385381.24915.8650.camel@camel> (raw)
In-Reply-To: <3FCBB639.10409@89glass.com>
References: <3FCBB639.10409@89glass.com>

On Mon, 2003-12-01 at 16:44, Jared Carr wrote:
> I am currently working on optimizing some fairly time consuming queries 
> on a decently large
> dataset.
> 
> The Following is the query in question.
> 
> SELECT z.lat, z.lon, z.city, z.state, q.date_time, c.make, c.model, c.year
>     FROM quotes AS q, zips AS z, cars AS c
>         WHERE
>             z.zip = q.zip AND
>             c.car_id = q.car_id AND
>             z.state != 'AA' AND
>             z.state != 'AE' AND
>             z.state != 'AP' AND
>             z.state = 'WA'
>      ORDER BY date_time;
> 

This wont completely solve your problem, but z.state = 'WA' would seem
to be mutually exclusive of the != AA|AE|AP.  While it's not much, it is
extra overhead there doesn't seem to be any need for...

Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL




view thread (19+ messages)  latest in thread

Message-ID: <1070385381.24915.8650.camel@camel>
Permalink:  ../1070385381.24915.8650.camel@camel/
Also on:    postgresql.org/message-id/1070385381.24915.8650.camel@camel

 · 

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: xzilla@users.sourceforge.net, jared@89glass.com
  Subject: Re: A question on the query planner
  In-Reply-To: <1070385381.24915.8650.camel@camel>

* 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