Re: optimizing LIKE '%2345' queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2 Jul 2006, Gene wrote:

can use an index and perform as fast as searching with like '2345%'?

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.


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux