On Mon, May 15, 2017 at 6:21 PM, Patrick B <patrickbakerbr@xxxxxxxxx> wrote: > I created a view selecting from both tables, with a UNION ALL between them. > When selecting from that view, it's really slow. I can't even run explain > analyze (it's been 1h and query did not finished yet). Have you ruled out locks? Let the select run and check pg_stat_activity and pg_locks. If everything is good there, please paste contents of explain (without analyze) and explain analyze of the 'good' queries. merlin -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general