Re: optimizing LIKE '%2345' queries
От | Gene |
---|---|
Тема | Re: optimizing LIKE '%2345' queries |
Дата | |
Msg-id | 430d92a20607041327r4bcd6306ofec4adec6856c037@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: optimizing LIKE '%2345' queries (Tarhon-Onu Victor <mituc@iasi.rdsnet.ro>) |
Ответы |
Re: optimizing LIKE '%2345' queries
|
Список | pgsql-performance |
Thanks for the suggestion. Actually I went ahead and created a reverse function using plpgsql, created an index using reverse column and now my queries use "where reverse(column) like reverse('%2345') and it's using the index like i hoped it would! Now if I could figure out how to optimize like '%2345%' queries. I don't want to create many indexes though the table is very write heavy. > > Is the only way to create a reverse function and create an index using > > the reverse function and modify queries to use: > > > > where reverse(column) like reverse('%2345') ? > > Hmm.. interesting. > If (and only if) the records stored in "column" column have fixed > length (say, all are 50 characters in length) you could create and index > on, say, substring(column,45,50), and use this in the WHERE clauses in > your queries. > Or if the length of those records is not the same maybe it is > feasible to create an ondex on substring(column, length(column)-5, > length(column)). > > -- > Any views or opinions presented within this e-mail are solely those of > the author and do not necessarily represent those of any company, unless > otherwise expressly stated. >
В списке pgsql-performance по дате отправления: