Re: Boyer-Moore, no less

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Boyer-Moore, no less
Date: 2012-06-10 12:33:06
Message-ID: 4FD49402.1090808@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10.06.2012 14:28, Erik Rijkers wrote:
> Searching for Boyer-Moore in the manual, one only finds the following line (in the 8.4 release
> notes):
>
> "Improve the performance of text_position() and related functions by using Boyer-Moore-
> Horspool searching (David Rowley)"
>
> I have two questions:
>
> 1. Where in postgres is the Boyer-Moore algorithm used? (What happened to text_position() anyway?)

text_position() is in src/backend/utils/adt/varlena.c. It was split into
a few subroutines, which together implement the Boyer-Moore algorithm.
The internal text_position() function backs the SQL-style
POSITION(substring IN string) syntax. In hindsight, the release notes
should've spelled out POSITION(substring IN string), rather than just
assume that people know that text_position() refers to that.

> 2. Shouldn't there be, for 'advocacy' reasons, a mention of this well-known algorithm in the
> manual proper? (I can make a doc-patch if needed)

Doesn't seem necessary to me. I don't see any natural place to put such
a notice in the docs. I think people just rightly assume that the
built-in functions are implemented efficiently, and no need to go into
details.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-06-10 12:36:56 Re: Ability to listen on two unix sockets
Previous Message Fujii Masao 2012-06-10 12:25:38 Re: pg_basebackup blocking all queries with horrible performance