SELECT * FROM "public"."Releases" WHERE array_to_string(synonyms, ', ') ILIKE '%test%';
=# create table test (t text);
=# insert into test values ('DG1875'),('DG1885');
=# create index on test (cast(substr(t, 3) as int));
=# select * from test where cast(substr(t, 3) as int) = 1875;
t
--------
DG1875
=# explain analyze select * from test where cast(substr(t, 3) as int) = 1875;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Index Scan using test_substr_idx1 on test (cost=0.13..8.14 rows=1 width=32) (actual time=0.020..0.021 rows=1 loops=1)
Index Cond: ((substr(t, 3))::integer = 1875)
Planning time: 0.142 ms
Execution time: 0.057 ms
=# select ltrim('ABC1875', 'ABC');
ltrim
-------
1875
SELECT city, country, title, tagline, description, tags
FROM trips
WHERE fts @@ plainto_tsquery('ru','гауди')
ORDER BY ts_rank_cd(fts, plainto_tsquery('ru','тайны гауди')) DESC
LIMIT 100;
SELECT city, country, title, tagline, description, tags
FROM trips
WHERE fts @@ plainto_tsquery('ru','гауди')
ORDER BY fts <=> plainto_tsquery('ru','тайны гауди')
LIMIT 100;