Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ7rk-0002Zc-P9 for pgsql-performance@arkaria.postgresql.org; Thu, 27 Feb 2014 20:47:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WJ7rj-0003tK-WD for pgsql-performance@arkaria.postgresql.org; Thu, 27 Feb 2014 20:47:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ7ri-0003tD-OY for pgsql-performance@postgresql.org; Thu, 27 Feb 2014 20:47:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ7rg-0005Sc-J5 for pgsql-performance@postgresql.org; Thu, 27 Feb 2014 20:47:34 +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 s1RKlUnA015432; Thu, 27 Feb 2014 15:47:30 -0500 From: Tom Lane To: Tom Coogan cc: sfrost@snowman.net, pgsql-performance@postgresql.org Subject: Re: Inefficient filter order in query plan In-reply-to: References: <1633.1393520657@sss.pgh.pa.us> Comments: In-reply-to Tom Coogan message dated "Thu, 27 Feb 2014 15:34:04 -0500" Date: Thu, 27 Feb 2014 15:47:30 -0500 Message-ID: <15431.1393534050@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Tom Coogan writes: > Thanks Tom but why would strict equality checking (e.g. model = > 'User') have the same cost as LIKE operations which (may) have to do > pattern matching? A bit of consultation of pg_proc.procost will show you that just about the only internal functions with costs different from 1X cpu_operator_cost are those that do some sort of database access (and, in consequence, have true costs a couple orders of magnitude higher than a simple comparison). We may eventually get around to refining the cost model so that it can tell the difference between = and LIKE, but nobody's yet done the work to decide which functions ought to get assigned what costs. I'm disinclined to single out LIKE for special treatment in the absence of some sort of framework for deciding which functions are worth penalizing. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance