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 ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings