Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9BEA9650068 for ; Mon, 8 Sep 2008 16:19:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93670-07 for ; Mon, 8 Sep 2008 16:19:14 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by postgresql.org (Postfix) with ESMTP id 58CA7650078 for ; Mon, 8 Sep 2008 16:19:14 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id 29so629547ugo.7 for ; Mon, 08 Sep 2008 12:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:mime-version:content-type:content-transfer-encoding :x-priority:x-msmail-priority:x-mailer:in-reply-to:x-mimeole :importance:thread-index; bh=+jzXFHVzZd+Z4jQIQVOyr3L90FafAQrRVIKImLcMJEc=; b=fg6DSJ9nzHef2BhfuZkAhiKwaPuzuJ9wKqTbDU6vlzrQHCDXB+jG1ygvHpAMO2kt8X q1yzisMAVB03uYec0HDP70tB6I49RlHhE0/KjGCtQ8e6QOqdl7pXJtouVW333f0znFHl IvOtIuSnjTN3a3FixNXybqtfdaGwYvjSPx07I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding:x-priority:x-msmail-priority:x-mailer :in-reply-to:x-mimeole:importance:thread-index; b=GdSEmdAAJ8Xi/ERD6MqDLUF2cU3WOFQGnL7RLaYJqfytQwrbGAMN7D5XaWE/nhtlyA kEziOwzTohMsbaiQIPUsb8GBjUQbLGRKbL32cmE6ecvMy75jzJzBvP1jLSGnPvBJrJKz rsEWwiYOPaPJTYPYW6Y8S8DFLGWnGH+1cTr+Y= Received: by 10.66.220.17 with SMTP id s17mr4372872ugg.48.1220901552388; Mon, 08 Sep 2008 12:19:12 -0700 (PDT) Received: from amd64 ( [83.104.138.235]) by mx.google.com with ESMTPS id i39sm9034157ugd.21.2008.09.08.12.19.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 08 Sep 2008 12:19:11 -0700 (PDT) From: "David Rowley" To: "'Heikki Linnakangas'" , "'Tom Lane'" Cc: "'Peter Eisentraut'" , Subject: Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker) Date: Mon, 8 Sep 2008 20:19:35 +0100 Message-ID: <0D0F8DC5EE1341A199B5BDA73F870BA7@amd64> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6838 In-Reply-To: <48C4C9FE.20905@enterprisedb.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Importance: Normal Thread-Index: AckRfnaYUWsvDf3dRe+w8CrtX6WyPQAaMKgg X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/97 X-Sequence-Number: 7112 Heikki Linnakangas Wrote: > Tom Lane wrote: > > Heikki Linnakangas writes: > >> Also, it would be nice to use B-M(-H) for LIKE as well. > >=20 > > Right offhand, that seems impossible, at least in patterns with %. > > Or were you thinking of trying to separate out the fixed substrings > > of a pattern and search for them with BMH? > Yep, something like that. Even if it only handled the special case of=20 > '%foobar%', that would be nice, because that's a pretty common special = > case. It would be a quick test to check for % at either end. But we'd also = need to ensure there were none in the middle. That might slow it down. I guess = while looping over the inner chars checking for more %'s we could be building = a skiptable. We'd have to abort it if we found any %'s of course I think with out giving it much thought _'s could be handled by BMH, = these could just be given a skip distance of 2. Only having a lossy skip table throws that out the window without having a special check for _ David.