Mark Pasterkamp <markpasterkamp1994(at)gmail(dot)com> writes:
> I was wondering if someone could help me understands what a union all
> actually does.
Generally speaking, it runs the first query and then the second query.
You'd really need to provide a lot more detail for anyone to say more
than that.
https://wiki.postgresql.org/wiki/Slow_Query_Questions
regards, tom lane