public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: James Addison <[email protected]>
Cc: [email protected]
Subject: Re: Question: consolidating strpos searches?
Date: Sat, 04 Jan 2025 12:45:11 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CALDQ5Ny-+ZxLuJiqC11EafO11F-KVSBgWnrWqWpRt4bw1L+hhw@mail.gmail.com>
References: <CALDQ5Ny-+ZxLuJiqC11EafO11F-KVSBgWnrWqWpRt4bw1L+hhw@mail.gmail.com>

James Addison <[email protected]> writes:
> In other words: each additional strpos(value, ...) expression
> increased the evaluation time by a similar, significant duration of
> two seconds.  This seems to confirm the basis that each expression is
> currently evaluated separately, by an independent read from the input
> text.

That's correct.  We have not felt a need to try to identify duplicate
function calls: the cost of looking for them would seldom be repaid,
so that such an optimization would be a net loss for most people.
(In your example, they're not even truly duplicates.)

> I'd like to suggest the introduction of a documented multiple string
> matching algorithm[1], to yield results for each of multiple strpos
> calls while only reading through their common input text at-most once.

This seems like something with a pretty narrow audience.  I'd suggest
building it as an extension rather than trying to persuade people
it belongs in core Postgres.

			regards, tom lane





view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Question: consolidating strpos searches?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox