From: Justin Pryzby <pryzby@telsasoft.com>
To: Craig James <cjames@emolecules.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: UNION causes horrible plan on JOIN
Date: Mon, 28 Oct 2019 17:45:53 -0500
Message-ID: <20191028224553.GP23808@telsasoft.com> (raw)
In-Reply-To: <CAFwQ8reoBtrjfBM3rJuFg2LndWu-LHbXsU4knDyrVK+wo8PAug@mail.gmail.com>
References: <CAFwQ8reoBtrjfBM3rJuFg2LndWu-LHbXsU4knDyrVK+wo8PAug@mail.gmail.com>
On Mon, Oct 28, 2019 at 03:40:58PM -0700, Craig James wrote:
> On Postgres 9.6 (config below), I have a case I don't understand: three
> tables that can be separately queried in milliseconds, but when put
> together into one view using UNION, take 150 seconds to query. Here's the
> rough idea (actual details below):
Do you want UNION ALL ?
UNION without ALL distintifies the output.
https://www.postgresql.org/docs/current/sql-select.html#SQL-UNION
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: pryzby@telsasoft.com, cjames@emolecules.com, pgsql-performance@lists.postgresql.org
Subject: Re: UNION causes horrible plan on JOIN
In-Reply-To: <20191028224553.GP23808@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox