Re: Left joining table to setof function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: robert(at)webtent(dot)com
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Left joining table to setof function
Date: 2007-09-08 01:59:10
Message-ID: 3524.1189216750@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert Fitzpatrick <lists(at)webtent(dot)net> writes:
> trax=# explain analyze select * from client_search_id_func(62) left join tblsearch_selections ON search_id = 62 and user_id = 'RF' and ((selected_value = clientno and selection_type = 'client') or (selected_value = contactno and selection_type = 'contact'));

I don't think you're going to get anywhere until you get rid of the
OR-of-ANDs join condition; the OR defeats using any reasonably
intelligent join method such as a merge or hash join. You should
redesign the set-returning function to emit a representation that
matches the table you want to search, or perhaps rethink the table's
representation.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2007-09-08 03:38:40 Re: Query with "like" is really slow
Previous Message Scott Marlowe 2007-09-08 01:52:20 Re: CLOB support in postgresql