Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9093D1336971 for ; Mon, 14 Feb 2011 03:31:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 99471-06 for ; Mon, 14 Feb 2011 07:31:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from rs73.luxsci.com (rs73.luxsci.com [64.49.254.135]) by mail.postgresql.org (Postfix) with ESMTP id A768413364DE for ; Mon, 14 Feb 2011 03:31:50 -0400 (AST) Received: from GNANAM ([180.151.61.10]) (authenticated bits=0) by rs73.luxsci.com (8.13.8/8.13.8) with ESMTP id p1E7VfpA010105; Mon, 14 Feb 2011 01:31:43 -0600 Reply-To: From: "Gnanakumar" To: "'Richard Huxton'" Cc: References: <004601cbcc14$acfe99d0$06fbcd70$@com> <4D58D752.2000100@archonet.com> In-Reply-To: <4D58D752.2000100@archonet.com> Subject: Re: How to boost performance of queries containing pattern matching characters Date: Mon, 14 Feb 2011 12:58:23 +0530 Organization: Zoniac Software Private Limited Message-ID: <004701cbcc18$c54c8980$4fe59c80$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcvMF21II+zDKt2SReCuak+Zhd9+gwAADXeQ Content-Language: en-us X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/371 X-Sequence-Number: 42509 > Is that really what you are after? Or, did you just want to match: > user1@domain.com > user2@sub.domain.com I understand that because I've (%) at the beginning and end, it's going to match unrelated domains, etc., which as you said rightly, it is wide-ranging. But my point here is that how can I improve performance of the queries containing pattern matching characters.