Search Postgresql Archives

Re: Why does it sort rows after a nested loop that uses already-sorted indexes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



negora <public@xxxxxxxxxx> writes:
> As you can see, the planner does detect that the outer loop returns the 
> rows presorted by [sales_order.id]. However, it's unable to detect that 
> the rows returned by the inner loop are also sorted by [sales_order.id] 
> first, and then by [order_line.id].

That's a level of analysis that it doesn't do, and TBH I'm not even
entirely sure it's correct to assume that the output is sorted like
that.  At minimum you'd need an additional assumption that the
outer side's join key is unique, which is a factor that we don't
currently track when reasoning about ordering.

			regards, tom lane





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux