| From: | Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> | 
|---|---|
| To: | Jared Carr <jared(at)89glass(dot)com> | 
| Cc: | pgsql-performance(at)postgresql(dot)org | 
| Subject: | Re: A question on the query planner | 
| Date: | 2003-12-02 17:16:21 | 
| Message-ID: | 1070385381.24915.8650.camel@camel | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-performance | 
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jared Carr | 2003-12-02 17:55:49 | Re: A question on the query planner | 
| Previous Message | Greg Stark | 2003-12-02 16:40:51 | Re: Update performance ... is 200, 000 updates per hour what I should expect? |