Re: [PERFORM] Slow join query

2007-06-22 Thread Scott Marlowe
Tom Tamulewicz wrote: SELECT p.party_id, p.first_name, p.last_name, pli.address1, pli.city, pli.state FROM customer as p JOIN address as pli ON ( p.party_id = pli.party_id ) WHERE ( p.void_flag IS N

Re: [PERFORM] Slow join query

2007-06-22 Thread Tom Tamulewicz
  From: Michael Glaesemann <[EMAIL PROTECTED]>To: Tom Tamulewicz <[EMAIL PROTECTED]>CC: pgsql-performance@postgresql.orgSubject: Re: [PERFORM] Slow join queryDate: Fri, 22 Jun 2007 14:51:32 -0500>>On Jun 22, 2007, at 13:32 , Tom Tamulewicz wrote:>>( p.void_flag IS NULL OR p.void_flag = false

Re: [PERFORM] Slow join query

2007-06-22 Thread Michael Glaesemann
[Please don't top post as it makes the discussion more difficult to follow.] On Jun 22, 2007, at 16:25 , Tom Tamulewicz wrote: The explain is as follows... EXPLAIN ANALYZE, please. (And for convenience, it helps if you include the query :) ) Michael Glaesemann grzm seespotcode net -

Re: [PERFORM] Slow join query

2007-06-22 Thread Tom Tamulewicz
The explain is as follows...    QUERY PLAN   

Re: [PERFORM] Slow join query

2007-06-22 Thread Michael Glaesemann
On Jun 22, 2007, at 13:32 , Tom Tamulewicz wrote: ( p.void_flag IS NULL OR p.void_flag = false ) Just a note: you can rewrite (a IS NULL or a = false) as (a IS NOT TRUE). Shouldn't affect performance, but might make your query easier to read. What's the EXPLAIN ANALYZE output for this quer

[PERFORM] Slow join query

2007-06-22 Thread Tom Tamulewicz
I have a query that runs about 30-50 seconds.  The query is a join between 2 tables (customer and address), each table with about 400,000 rows.  My customer table has fields like first_name and last_name where the address table has city, state, etc.  I'm using "like" in most of the query columns, w