X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D9420D1B215 for ; Tue, 18 May 2004 14:20:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 96775-08 for ; Tue, 18 May 2004 14:20:18 -0300 (ADT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id A05FAD1B1CA for ; Tue, 18 May 2004 14:20:14 -0300 (ADT) Received: (qmail 635 invoked by uid 65534); 18 May 2004 17:20:14 -0000 Received: from p5087F9DF.dip0.t-ipconnect.de (EHLO hermes.hilbert.loc) (80.135.249.223) by mail.gmx.net (mp009) with SMTP; 18 May 2004 19:20:14 +0200 X-Authenticated: #1433807 Received: (from ncq@localhost) by hermes.hilbert.loc (8.11.6/8.11.6/SuSE Linux 0.5) id i4IHF5I00741 for pgsql-sql@postgresql.org; Tue, 18 May 2004 19:15:05 +0200 Date: Tue, 18 May 2004 19:15:04 +0200 From: Karsten Hilbert To: pgsql-sql@postgresql.org Subject: Re: Very slow search using basic pattern matching Message-ID: <20040518191504.C607@hermes.hilbert.loc> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.22.1i Re-X-turn-receipt-to: Karsten.Hilbert@gmx.net Di-X-sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi-X-rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri-X-ority: 2 (High) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/158 X-Sequence-Number: 17872 > WHERE > da_records.DESCRIPTION_CY ~* '.*Aberystwyth*.' > OR > da_records.TITLE_CY ~* '.*Aberystwyth*.' > limit 100 > > Is there a better way of matching the string? (Must be case > insensitive) Are you sure you can't anchor the search pattern ? eg ~* '^' || lower('Aberystwyth') || '.*' That'd allow for use of (functional) indices. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346