psql -h localhost -U pony pg_guts \timing User.objects.count() User.objects.filter(name="Nadina POLO") User.objects.filter(name__startswith="Nadina POL") User.objects.filter(name__contains="adina POL") DROP INDEX main_user_name; CREATE INDEX main_user_name on main_user USING GIN (name gin_trgm_ops); User.objects.filter(name__contains="adina POL") User.objects.filter(name__icontains="adina POL") SELECT * FROM main_user WHERE name ILIKE '%adina POL%'; EXPLAIN SELECT * FROM main_user WHERE name ILIKE '%adina POL%'; -- DAFUQ, Upper? CREATE INDEX main_user_name_upper on main_user USING GIN (UPPER(name) gin_trgm_ops);