From: | "Sven R(dot) Kunze" <srkunze(at)mail(dot)de> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause |
Date: | 2016-09-29 12:20:31 |
Message-ID: | 8ccdd027-f4a0-2e0d-1e26-2a403fed8d17@mail.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 23.09.2016 11:00, Pavel Stehule wrote:
> 2016-09-23 8:35 GMT+02:00 Sven R. Kunze <srkunze(at)mail(dot)de
> <mailto:srkunze(at)mail(dot)de>>:
>
> I was wondering: would it be possible for PostgreSQL to rewrite
> the query to generate the UNION (or subquery plan if it's also
> fast) on it's own?
>
>
> It depends on real data. On your specific data the UNION variant is
> pretty fast, on different set, the UNION can be pretty slow. It is
> related to difficult OR predicate estimation.
I figure that the UNION is fast if the sub-results are small (which they
are in our case). On the contrary, when they are huge, the OUTER JOIN
variant might be preferable.
Is there something I can do to help here?
Or do you think it's naturally application-dependent and thus should be
solved with application logic just as we did?
Cheers,
Sven
From | Date | Subject | |
---|---|---|---|
Next Message | Cea Stapleton | 2016-09-29 12:36:55 | Failing Multi-Job Restores, Missing Indexes on Restore |
Previous Message | Alex Ignatov (postgrespro) | 2016-09-29 11:11:07 | Re: Millions of tables |