SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE EXTENSION pg_trgm; CREATE EXTENSION unaccent; CREATE TABLE tt1 (value text, testfield int); INSERT INTo tt1 (value, testfield) (SELECT generate_series::text || ' ' || (generate_series+1)::text, generate_series % 7 FROM generate_series(1000000, 2000000)); CREATE OR REPLACE FUNCTION f_unaccent(text) RETURNS text LANGUAGE sql IMMUTABLE PARALLEL SAFE AS $function$ SELECT unaccent('public.unaccent', $1) $function$ ; CREATE INDEX qweqwe ON tt1 USING gin (f_unaccent(value) gin_trgm_ops) WHERE testfield < 3; analyze tt1; explain select * from tt1 WHERE f_unaccent(value) like '%237%' AND testfield < 3;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear