X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E86B89DC988 for ; Tue, 17 Jan 2006 17:01:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13897-04 for ; Tue, 17 Jan 2006 17:01:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5F6D89DC86A for ; Tue, 17 Jan 2006 17:01:34 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k0HL1XBb021505; Tue, 17 Jan 2006 16:01:33 -0500 (EST) To: Yantao Shi cc: pgsql-performance@postgresql.org Subject: Re: wildcard search performance with "like" In-reply-to: <43CD4CE5.3020506@larcb.ecs.nasa.gov> References: <43CD4CE5.3020506@larcb.ecs.nasa.gov> Comments: In-reply-to Yantao Shi message dated "Tue, 17 Jan 2006 15:00:37 -0500" Date: Tue, 17 Jan 2006 16:01:33 -0500 Message-ID: <21504.1137531693@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.09 required=5 tests=[AWL=0.090] X-Spam-Score: 0.09 X-Spam-Level: X-Archive-Number: 200601/264 X-Sequence-Number: 16742 Yantao Shi writes: > testdbspc=# explain select file_name from catalog where file_name like > 'MOD04_L2.A2005311.%.004.2005312013%.hdf'; > QUERY PLAN > Seq Scan on catalog (cost=0.00..429.00 rows=1 width=404) > Filter: (file_name ~~ 'MOD04_L2.A2005311.%.004.2005312013%.hdf'::text) > (2 rows) I'm betting you are using a non-C locale. You need either to run the database in C locale, or to create a special index type that is compatible with LIKE searches. See http://www.postgresql.org/docs/8.1/static/indexes-opclass.html regards, tom lane