Hi, Unfortunately this got broken again, this time by aef65db676 :-(
I've tried to fix the merge conflict (essentially by moving some of the code to adjust_limit_rows_costs(), but I'm wondering if the code added to create_limit_path is actually correct if (count_est != 0) { double count_rows; if (count_est > 0) count_rows = (double) count_est; else count_rows = clamp_row_est(subpath->rows * 0.10); if (limitOption == WITH_TIES) { ... count_rows = Max(avgGroupSize, count_est + (...)); } ... } Firstly, this seriously needs some comment explaining why we do this. But more importantly - shouldn't it really be count_rows = Max(avgGroupSize, count_rows + (...)); instead of using count_est again (which might easily be -1 anyway)? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services