What indexes exist on those tables? How many rows do you expect to get back
in total? Is the last_contacted_anychannel_dttm clause restrictive, or does
that include most of the prospect table (check pg_stats for the histogram
if you don't know).

and (a."shared_paddr_with_customer_ind" = 'N')
               and (a."profane_wrd_ind" = 'N')
               and (a."tmo_ofnsv_name_ind" = 'N')
                   and (a."has_individual_address" = 'Y')
               and (a."has_last_name" = 'Y')
       and (a."has_first_name" = 'Y'))

Are these conditions expected to throw out very few rows, or most of the
table?

If you change both joins to EXISTS clauses, do you get the same plan when
you run explain?

Reply via email to