Re: Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions

From: johno <jan(dot)suchal(at)gmail(dot)com>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions
Date: 2014-07-21 22:22:52
Message-ID: CACuOPqDUv=Mb-4WLgtOBOJhvdhS-Hr-_sNSQFNQf0WiwGVDbBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>
>
> Try following my lead and bottom-post, please.
>

Sorry for that.

>
> Anyway, the query has no clue that because of the final LIMIT 100 that the
> two different feeding queries are just going to happen to end up providing
> the same result. Maybe, in this particular instance, it is theoretically
> possible to make such a proof but generally that is not the case and so
> such
> an optimization has not made into the codebase even if it theoretically
> could be done (I'm not convinced it could but do not know enough to explain
> to someone else why I have that impression).
>
> I do not know enough to answer why this situation is any different from a
> similar partitioning scenario. An example showing exactly what a similar
> partitioning query looks like would help in this regard.
>
> If you are looking for considerably more insight into the planner workings
> and why it does or doesn't do something you will need to wait for others.
> I
> can, to a reasonable degree, deconstruct a pair of queries and either
> explain or guess as to why things are happening but that is mostly applied
> deductive reasoning and not because I have any particular insight into the
> codebase.
>

Thanks again for your time. Let's just wait for someone else and see where
this will end up going.

Jano

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2014-07-22 02:53:01 Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions
Previous Message David G Johnston 2014-07-21 22:14:44 Re: Slow query with indexed ORDER BY and LIMIT when using OR'd conditions