Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aEejw-0005rK-3n for pgsql-performance@arkaria.postgresql.org; Thu, 31 Dec 2015 15:02:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aEejv-0004c4-LD for pgsql-performance@arkaria.postgresql.org; Thu, 31 Dec 2015 15:02:07 +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) (envelope-from ) id 1aEejv-0004bv-1C for pgsql-performance@postgresql.org; Thu, 31 Dec 2015 15:02:07 +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) (envelope-from ) id 1aEejs-00078n-LY for pgsql-performance@postgresql.org; Thu, 31 Dec 2015 15:02:05 +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 tBVF226X010595; Thu, 31 Dec 2015 10:02:02 -0500 From: Tom Lane To: Anton Melser cc: pgsql-performance@postgresql.org Subject: Re: Plan differences In-reply-to: References: Comments: In-reply-to Anton Melser message dated "Thu, 31 Dec 2015 11:12:58 +0100" Date: Thu, 31 Dec 2015 10:02:02 -0500 Message-ID: <10594.1451574122@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 Anton Melser writes: > I moved a DB between two "somewhat" similar Postgres installs and am > getting much worse plans on the second. The DB was dumped via pg_dump > (keeping indexes, etc.) and loaded to the new server. > [ "like 'foo%'" is not getting converted into index bounds ] I'd bet your old database is in C locale and the new one is not. The LIKE optimization requires an index that's sorted according to plain C (strcmp) rules. A regular text index will be that way only if the database's LC_COLLATE is C. If you don't want to rebuild the whole database, you can create indexes to support this by declaring them with COLLATE "C", or the older way is to declare them with text_pattern_ops as the index opclass. 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