-- CREATE FUNCTION benchmark_textpos(text, text, int4) RETURNS int4 AS '/path/to/src/test/regress/regress.so', 'benchmark_textpos' LANGUAGE C;

\timing on

-- no match
SELECT benchmark_textpos(repeat('a',           1000*1010)              , '1234567890', 1000) as nomatch;

-- match at the end:

-- ASCII haystack
SELECT benchmark_textpos(repeat('a',           1000*1000)||'1234567890', '1234567890', 1000) as ascii;

-- haystack is repeating pattern of 12 characters totaling 20 bytes
SELECT benchmark_textpos(repeat('abχxฐcdЖÈfg🙂', 50*1000)||'1234567890', '1234567890', 1000) as multibyte;

\timing off
