acdat finds many literal patterns in PostgreSQL text or bytea in a single
scan. Compile a dictionary once, then reuse it to locate matches or replace them.
Install the Linux package with PIG. Set -v to your PostgreSQL major (15–19). Get PIG
pig repo add pgsql -u
pig ext add acdat -v 19In the target database, find both terms and their starting byte positions.
CREATE EXTENSION acdat;
SELECT pattern_id, start_byte
FROM acdat.matches('timeout, then retry', acdat.compile(ARRAY['timeout', 'retry']))
ORDER BY start_byte;
-- pattern_id | start_byte
-- 1 | 1
-- 2 | 15