Search Postgresql Archives

Re: More records after sort

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

 



Nicolas Seinlet <nicolas@xxxxxxxxxxx> writes:
> I'm facing a strange behaviour and I don't understand why. From a wider query plan, https://explain.dalibo.com/plan/7yh ,a table is scanned and filter based on its primary key, returning 98 records. Then, those records are sorted on another field, and the output is 758,247,643 records.

You haven't showed us the whole plan; tsk tsk.

However, I'm going to bet that this sort is the inner input of a merge
join, and that the apparent "extra" tuples are caused by the merge backing
up and rescanning the sort result to deal with duplicate join keys in its
outer input.  There must be a heck of a lot of duplicates.  The planner
would typically avoid using merge join if it knew that, so I'm wondering
if you have up-to-date statistics for the outer side of the join.

			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