Oracle/mysql: create index idx_foo_blah on foo (blah (30)); Postgres: create index idx_foo_blah on foo ((substring (blah for 30)));