> exists (select ‘found_it’ from get_jobs(x.name) j where j.job = > ‘carpenter’); What does this function do ? If it only runs on the tables, than simple join will do it pretty fast. also, keeping job as integer, if table is large will save you some space, make index lookup faster, and generally make everything faster. Subselects always perform poor, so please try writing that query as join first. Postgresql is capable of reordering, and choosing right approach for query, this isn't mysql - you don't have try to outsmart db. -- GJ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general