Re: UNION causes horrible plan on JOIN - Mailing list pgsql-performance

From Craig James
Subject Re: UNION causes horrible plan on JOIN
Date
Msg-id CAFwQ8reOEP6xYYCiY2PpoFhOz8+7Tsn0uHSW9Cu3qttK58UJvg@mail.gmail.com
Whole thread Raw
In response to Re: UNION causes horrible plan on JOIN  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: UNION causes horrible plan on JOIN
List pgsql-performance
On Mon, Oct 28, 2019 at 3:45 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
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

Interesting idea, thanks. But it makes no difference. Tried it and got the same bad performance.

Craig
 


Justin


--
---------------------------------
Craig A. James
Chief Technology Officer
eMolecules, Inc.
3430 Carmel Mountain Road, Suite 250
San Diego, CA 92121
---------------------------------

pgsql-performance by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: UNION causes horrible plan on JOIN
Next
From: Craig James
Date:
Subject: Re: UNION causes horrible plan on JOIN