Re: Lexicographic index ?
От | Jeff Eckermann |
---|---|
Тема | Re: Lexicographic index ? |
Дата | |
Msg-id | 20020516142606.35386.qmail@web20809.mail.yahoo.com обсуждение исходный текст |
Ответ на | Re: Lexicographic index ? ("Marin Dimitrov" <marin.dimitrov@sirma.bg>) |
Список | pgsql-general |
An alternative, which may work well for you: create an index on a substring (say, the first five or six characters) of each word, and match against that. To index on a substring, you will need to create a function, something like: CREATE FUNCTION word_substring(text) RETURNS text AS' SELECT substr($1, 1, 5); 'LANGUAGE SQL WITH (iscachable); CREATE INDEX word_substring_index ON word_table (word_substring(word)); --- Marin Dimitrov <marin.dimitrov@sirma.bg> wrote: > > ----- Original Message ----- > From: <arnaud.mlist1@free.fr> > > > > > > And what I want to built a query that tells me if > a word given in argument > can > > be found at least partially in the database. > Something like > > > > select * from twords where words||'%' like > 'saxophones'; > > > > works but uses a sequential scan on the table... > > > > > try > http://techdocs.postgresql.org/techdocs/fulltextindexing.php > > hth, > > Marin > > ---- > "...what you brought from your past, is of no use in > your present. When > you must choose a new path, do not bring old > experiences with you. > Those who strike out afresh, but who attempt to > retain a little of the > old life, end up torn apart by their own memories. " > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the > unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com
В списке pgsql-general по дате отправления: