Re: SELECT...VIEW...UNION...LIMIT - Mailing list pgsql-general

From Greg Stark
Subject Re: SELECT...VIEW...UNION...LIMIT
Date
Msg-id 873byy3294.fsf@stark.xeocode.com
Whole thread Raw
In response to SELECT...VIEW...UNION...LIMIT  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-general
"Ed L." <pgsql@bluepolka.net> writes:

>     create view big_view as
>         select *, 'big_table'::varchar as source from big_table
>         union
>         select *, 'small_table'::varchar as source from small_table;

Try "UNION ALL" instead of just "union"

The difference is that union has to avoid duplicates. If you want duplicates
to be included or know for certain there will be no duplicates then union all
is faster.

--
greg

pgsql-general by date:

Previous
From: "Edmund Kleiser"
Date:
Subject: select into temp tables withough using EXECUTE in plpgsql
Next
From: JM
Date:
Subject: HELP speed up my Postgres