Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cT8WE-0007HY-Rd for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Jan 2017 14:44:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cT8WD-0001F7-PR for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Jan 2017 14:44:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cT8VZ-0000VZ-94 for pgsql-bugs@postgresql.org; Mon, 16 Jan 2017 14:43:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cT8VV-0006vZ-Es for pgsql-bugs@postgresql.org; Mon, 16 Jan 2017 14:43:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v0GEhWSX005717; Mon, 16 Jan 2017 09:43:33 -0500 From: Tom Lane To: zszabo@chemaxon.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14495: Cost of comparator is not taken into account in sorting In-reply-to: <20170116111312.1441.16240@wrigleys.postgresql.org> References: <20170116111312.1441.16240@wrigleys.postgresql.org> Comments: In-reply-to zszabo@chemaxon.com message dated "Mon, 16 Jan 2017 11:13:12 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5715.1484577812.1@sss.pgh.pa.us> Date: Mon, 16 Jan 2017 09:43:32 -0500 Message-ID: <5716.1484577812@sss.pgh.pa.us> X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org zszabo@chemaxon.com writes: > Our problem is that the cost of sorting by the Molecule column does not take > into account the cost of the comparison by molecule_relevance_compare() at > all! Yeah, cost_sort just uses cpu_operator_cost as the estimated cost per comparison. It's unlikely anyone is going to be very excited about changing that. It would be quite expensive to look up a function-specific cost on every call, and cost_sort is called often enough during planning that that expense would be a problem. Also, some call sites don't supply enough information to do such a lookup at all; requiring them to provide it would add more expense, and complication. So I don't really see us adding that much overhead to support such a corner case as an unduly-expensive sort comparator. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs