Claudio Freire <klaussfreire@xxxxxxxxx> writes: > CREATE OR REPLACE VIEW member_all_tags_v AS > SELECT member_tags.member_id, member_tags.last_modification_date, > member_tags.polarity, member_tags.tag_id, 'mr' AS source > FROM member_tags > UNION ALL > SELECT member_profile_tags.member_id, > member_profile_tags.last_modification_date, member_profile_tags.polarity, > member_profile_tags.tag_id, 'profile' AS source > FROM member_profile_tags; Try casting those constants to text (or something) explicitly, ie 'mr'::text AS source etc. I forget at the moment why leaving them as unknown literals interferes with optimization, but it does. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance