Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVvOs-0005uB-4k for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Oct 2013 03:34:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VVvOq-0007Zs-V6 for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Oct 2013 03:34:25 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVn4d-0000z2-N8 for pgsql-bugs@postgresql.org; Mon, 14 Oct 2013 18:40:59 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVn4b-00045k-Mz for pgsql-bugs@postgresql.org; Mon, 14 Oct 2013 18:40:59 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VVn4b-00056C-31 for pgsql-bugs@postgresql.org; Mon, 14 Oct 2013 18:40:57 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1VVn4V-0008Qy-EY for pgsql-bugs@postgresql.org; Mon, 14 Oct 2013 18:40:51 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: BUG #8525: using ltree <@ ltree[] leads too very bad cost estimates To: pgsql-bugs@postgresql.org From: pavel.rosputko@gmail.com Message-Id: Date: Mon, 14 Oct 2013 18:40:51 +0000 X-Pg-Spam-Score: 0.4 (/) 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 The following bug has been logged on the website: Bug reference: 8525 Logged by: Pavel Rosputko Email address: pavel.rosputko@gmail.com PostgreSQL version: 9.3.0 Operating system: Linux Description: postgres@a2access=# explain (analyze) select * from locations where text2ltree(coalesce(replace(ancestry, '/', '.'), '')) || id::text <@ '71'; QUERY PLAN ────────────────────────────────────────────────────────────────────────────────────────────────────────── Seq Scan on locations (cost=0.00..55.65 rows=27 width=90) (actual time=0.134..3.113 rows=24 loops=1) Filter: ((text2ltree(COALESCE(replace((ancestry)::text, '/'::text, '.'::text), ''::text)) || (id)::tex… …t) <@ '71'::ltree) Rows Removed by Filter: 1322 note rows=27 and actual rows=24 whereas postgres@a2access=# explain (analyze) select * from locations where text2ltree(coalesce(replace(ancestry, '/', '.'), '')) || id::text <@ array['71']::ltree[]; QUERY PLAN ────────────────────────────────────────────────────────────────────────────────────────────────────────── Seq Scan on locations (cost=0.00..55.65 rows=1 width=90) (actual time=0.141..3.279 rows=24 loops=1) Filter: ((text2ltree(COALESCE(replace((ancestry)::text, '/'::text, '.'::text), ''::text)) || (id)::tex… …t) <@ '{71}'::ltree[]) Rows Removed by Filter: 1322 -> rows=1 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs