\timing on do $$ declare txt text := repeat(chr(2037), 1000); pat text := '^\w*$'; begin raise notice 'result of txt ~ pat = %', txt ~ pat; for i in 1..1000000 loop perform txt ~ pat; end loop; end$$;