Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ4No-0002yG-Op for pgsql-performance@arkaria.postgresql.org; Thu, 27 Feb 2014 17:04:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WJ4No-0005uY-9M for pgsql-performance@arkaria.postgresql.org; Thu, 27 Feb 2014 17:04:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ4Nn-0005uO-Hs for pgsql-performance@postgresql.org; Thu, 27 Feb 2014 17:04:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ4Nl-0001VG-1d for pgsql-performance@postgresql.org; Thu, 27 Feb 2014 17:04:27 +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 s1RH4HKG001634; Thu, 27 Feb 2014 12:04:18 -0500 From: Tom Lane To: Tom Coogan cc: pgsql-performance@postgresql.org Subject: Re: Inefficient filter order in query plan In-reply-to: References: Comments: In-reply-to Tom Coogan message dated "Thu, 27 Feb 2014 11:57:42 -0500" Date: Thu, 27 Feb 2014 12:04:17 -0500 Message-ID: <1633.1393520657@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: > I'd like to understand why PostgreSQL is choosing to filter on the most > inefficient predicate first in the query below. It doesn't know that LIKE is any more expensive than the other operators, so there's no reason to do them in any particular order. You could try increasing the cost attributed to the texticlike() function if you don't like the results you're getting here. 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