agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas@2ndquadrant.com>
Subject: [PATCH 2/4] fix costing in cost_incremental_sort
Date: Tue, 9 Jul 2019 00:13:04 +0200

---
 src/backend/optimizer/path/costsize.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 7f820e7351..c6aa17ba67 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -1875,16 +1875,8 @@ cost_incremental_sort(Path *path,
 				   limit_tuples);
 
 	/* If we have a LIMIT, adjust the number of groups we'll have to return. */
-	if (limit_tuples > 0 && limit_tuples < input_tuples)
-	{
-		output_tuples = limit_tuples;
-		output_groups = floor(output_tuples / group_tuples) + 1;
-	}
-	else
-	{
-		output_tuples = input_tuples;
-		output_groups = input_groups;
-	}
+	output_tuples = input_tuples;
+	output_groups = input_groups;
 
 	/*
 	 * Startup cost of incremental sort is the startup cost of its first group
-- 
2.21.0


--z44ikx7gwyo2xwzv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
 filename="0003-fix-explain-in-parallel-mode-20190709.patch"



view thread (31+ messages)  latest in thread

Message-ID: <no-message-id-1881992@localhost>
Permalink:  ../../no-message-id-1881992@localhost/
Also on:    postgresql.org/message-id/no-message-id-1881992@localhost

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas@2ndquadrant.com
  Subject: Re: [PATCH 2/4] fix costing in cost_incremental_sort
  In-Reply-To: <no-message-id-1881992@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox