Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
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 SET search_path TO public 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 f_unaccent('%237%') AND testfield < 3;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear